home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / database / eb106a.zip / PACK1.PRG / EB2.REP (.txt) < prev    next >
PC-File  |  1996-04-02  |  177KB  |  3,275 lines

  1.                           EASY BASE USERS MANUAL
  2.                           
  3.                                 Contents
  4.                                 
  5.             System Overview..............................   1
  6.             Data Management Principles...................   2
  7.             Form Design..................................   6
  8.             Relationships and Lookups....................  11
  9.             Data Entry...................................  15
  10.             Procedures (Reporting).......................  20
  11.             Procedures (Transactional)...................  36
  12.             User Menus...................................  39
  13.             External File Access.........................  43
  14.             Data File Format.............................  45
  15.             System Requirements and Limitations..........  46
  16.             DOS Filename Convention......................  47
  17.             Selected Programming Topics..................  49
  18.       Easy Base is copyright (c) John Turnbull 1994 published by:-
  19.       Easy Software                  Tel/FAX (044) (0) 1625 614669
  20.       3 Brookside Court              CIS 100410,717
  21.       Prestbury Road
  22.       Macclesfield
  23.       SK10 3BR
  24.       UK
  25. ................................................................................
  26.                                TERMINOLOGY
  27.                                
  28.      Field          The storage space for an individual data item.
  29.      
  30.      Record         A set of related data items.
  31.      
  32.      Form           The storage space for a set of records.
  33.      
  34.      Procedure      A set of instructions which manipulate the data
  35.      
  36.       stored in forms.
  37.      Relationship   A record in the relationships form recording
  38.      
  39.    a link between forms.
  40. ................................................................................
  41.                       EASY BASE SYSTEM OVERVIEW
  42.      Easy Base is a complete rapid programming system for data
  43.      management. Virtually every data management problem can be
  44.      broken down into three areas. Creating disk files (referred to
  45.      as "Forms" in Easy Base) in which to store data, creating
  46.      procedures which manipulate that data and presenting those
  47.      forms and procedures in a logical menu system for use.
  48.      In Easy Base you create the forms in which to store data in a
  49.      simple screen-painting environment which not only designs the
  50.      data file but at the same time provides a default data entry
  51.      screen for your data. As you place the "Fields" in which data
  52.      is to be stored you can use relational links ("Lookups") to
  53.      import data from other forms. Each field you create for data
  54.      storage is also treated as a deriveable "Cell" similar to a
  55.      spread sheet. You can make almost any calculation or derivation
  56.      within a field as, apart from all arithmetic, relational and
  57.      logical operators, Easy Base also provides a set of over fifty
  58.      functions covering everything from Modulo arithmetic to
  59.      spelling out dates. Once you have created your forms you can
  60.      use the default screen to enter and view your data using the
  61.      "Data Entry" system.
  62.      Once you have data stored you will need to be able to
  63.      manipulate it and report on it. Easy Base provides a combined
  64.      transaction and reporting system ("Procedure Generator"). With
  65.      the procedure generator you can use the default screens you
  66.      have designed or create custom screens in which to gather input
  67.      either from the keyboard or from relational Lookups. You then
  68.      instruct Easy Base what to do with this information using a
  69.      simple "Basic" like programming language. If your procedure is
  70.      transactional you have commands to enter, modify or delete
  71.      records in any number of forms within a single procedure. If
  72.      your procedure is reporting then there are commands to group,
  73.      order and list data in almost every conceivable way.
  74.      You now have all the "Parts" required to create a useful data
  75.      management program. All that remains is to tie your procedures
  76.      to a menu system so that other people can use your application
  77.      without having to know anything about Easy Base. Creating an
  78.      end user menu system in Easy base is as simple as filling in a
  79.      form with the text you wish to display and the procedure or
  80.      form you wish to run. You give at least one of your menus a
  81.      start up password. If you then restart Easy Base but sign on
  82.      with that password instead of your developers password then you
  83.      will be running your own custom designed program.
  84.                                  - 1 -
  85. ................................................................................
  86.                      DATA MANAGEMENT PRINCIPLES
  87.      In Easy Base, creating forms and entering data is very easy.
  88.      You will be tempted to rush on and create programs for yourself
  89.      without reading the "Bumf". However, unless you are an
  90.      experienced data programmer, you should at least read this
  91.      section and the one on Relationships before embarking on any
  92.      serious project.
  93.      The crux of data management is "Data Integrity" or "Data
  94.      Verification".  You might know that "A Smith", "Smith's Garage"
  95.      and "Smith and Son" are all the same customer of yours but your
  96.      computer definitely does not! If you have a small business you
  97.      might wish to use Easy Base to create invoices - you might be
  98.      tempted to start by creating an invoice form in which you enter
  99.      your customers name, work done and price. - DON'T - Start
  100.      instead by creating a form to hold each of your customers'
  101.      names, addresses, credit limit etc.  If you sell things then
  102.      create a form to hold each of your stock items with their name,
  103.      partno, price etc.  These are your "Core" data forms from
  104.      which you "Lookup" data for other purposes. Each of your "Core"
  105.      data forms has a "Unique" field which defines the record as an
  106.      entity. "Smith's Garage" will always be "Smith's Garage" and
  107.      the lookup function described later will not allow any other
  108.      representation to be entered.
  109.      Although of less significance than "Data Integrity", the names
  110.      which you give to forms and fields are very important and worth
  111.      mentioning now. When you come to write "Lookup" derivations and
  112.      later, Procedural code you have to refer to your data by a
  113.      combination of its form and field names. Please give
  114.      considerable thought to the names you use. Each name should be
  115.      short but fully describe the form or field. The names of forms
  116.      should be plural and the names of fields singular. For example
  117.      - a form which is to hold details of your customers should be
  118.      called "Customers", the name field should be called "Name" and
  119.      the credit limit field should be called "Creditlimit" . When
  120.      you need to lookup data from this form the lookup function will
  121.      be written - Lookup(customers,name) and when you write
  122.      procedures the data will be referred to as customers.name ,
  123.      customers.creditlimit etc.  If you did not follow this naming
  124.      convention and called the form "F1" , the name field "customer"
  125.      and the credit limit field "Max cred" then writing procedure
  126.      code would be extremely frustrating.
  127.      It is equally important to give the same name to fields which
  128.      hold the same data in different forms. If you already had a
  129.      form called "Employees" which had fields "Worksno", "Name",
  130.      "Address" and "Taxcode" and you then created a "Payslips" form
  131.      the fields which hold the employee's name and taxcode should
  132.      also be called "Name" and "Taxcode". This not only makes it
  133.      easier to remember field names but when you come to write
  134.                                  - 2 -
  135. ................................................................................
  136.      procedure code, data can be transferred between one form and
  137.      another with the command "Copy all from". This command only
  138.      transfers data between fields with the same name. If you have
  139.      given different names to the fields in the two forms you will
  140.      have to transfer each individual field separately.
  141.      The fields which you create are of four general types - The
  142.      definition (unique) field, grouping fields, ordering fields and
  143.      descriptive fields.
  144.      When you create your "Core" data forms it will be fairly
  145.      obvious which is the definition field. In the "Employees" form
  146.      "Worksno" defines the record. In a "Manufacturers" form "Name"
  147.      defines the record. As a general rule, each form should have a
  148.      definition field. There is an exception to this where a form is
  149.      used to store temopary lists (described later) but for the
  150.      moment you should expect to have a definition or "Unique" field
  151.      on each form to prevent duplicate entries. When you create
  152.      secondary forms which lookup data from your "Core" forms the
  153.      data which defines the record as an entity will not necessarily
  154.      be contained solely in one of the fields you wish to display.
  155.      As an example - A magazine wholesaler has two "Core" forms, one
  156.      containing details of the magazines he supplies and one
  157.      containing customers details. He creates a form on which to
  158.      record orders from his customers. This "orders" form has three
  159.      fields, "Name"(for the customer), "Magazine" and "Quantity".
  160.      When a customer phones in an order for a particular magazine
  161.      the wholesaler will need to be warned if this particular
  162.      customer has already ordered this particular magazine but no
  163.      one field defines the record. In fact the record is defined as
  164.      unique by a combination of the two fields "Name" and "Magazine"
  165.      In this case, a fourth field should be added to the form in
  166.      which the two fields "Name" and "Magazine" are combined using
  167.      the "jointext" function. This field is then the "Unique" field
  168.      and no duplicate entries will be allowed.
  169.      In many secondary forms the records definition will be even
  170.      less obvious but if you are to create data storage for flexible
  171.      reporting you should always attempt to create a suitable
  172.      "unique" field.
  173.      For example :- An "Aircraft" form has a field "Manufacturer"
  174.      which is looked up from a "Manufacturers" form. It also has
  175.      fields for "Name" and "Mark". The definition of an aircraft is
  176.      what it is known as. If it has a name then it is known as a
  177.      combination of the manufacturer and the name (Supermarine
  178.      Spitfire) but if it does not have a name it is known as a
  179.      combination of the manufacturer and mark (English Electric P1b)
  180.      Even in these more complicated situations you can still create
  181.      a unique field to prevent duplicates. In the above example you
  182.      would create the unique field "Knownas" and derive it with the
  183.                                  - 3 -
  184. ................................................................................
  185.      formula - Jiontext(manufacturer,if(name = blank,mark,name))
  186.      When you define a field as unique Easy Base automatically
  187.      indexes this field.
  188.      The second type of field is a "Grouping" field. This is a field
  189.      which will be used in procedures to select subsets of records.
  190.      In the "Aircraft" form you might add a field "Type" which would
  191.      qualify each record as belonging to a group - "Fighter",
  192.      "Bomber", "Transport" etc. Grouping fields should also be
  193.      defined as indexed and should always be subject to data
  194.      integrity checking. Where the number of groups is small (17 or
  195.      less) Easy Base provides a quick method of data verification in
  196.      the "Choice" field type. If the number of groups is larger than
  197.      17 then you should create a "Core" form to hold the group names
  198.      and look them up into the secondary form.
  199.      The third type of field is used for ordering data. In many
  200.      instances the order in which you wish to print or view data
  201.      will be that of the definition field or one of the grouping
  202.      fields but not always. In the "Aircraft" form you might wish to
  203.      list them by the dates they were first introduced or by the
  204.      total production runs. In order to do this you would have to
  205.      add fields for "Date" and "Production". You would later write
  206.      procedures to list the aircraft with "Date in order" or
  207.      "production in order". Ordering fields should also be indexed
  208.      but they need not necessarily be checked for data integrity.
  209.      Fields which are not used for ordering or grouping are
  210.      descriptive and need not be indexed or integrity checked.
  211.      One of the most common mistakes made by beginners to data
  212.      management is to create different forms for the same data.
  213.      With the "Aircraft" form above you might be tempted to save all
  214.      the military aircraft of World War 1. Later you might create a
  215.      second form for the aircraft of World War 2. This would be a
  216.      mistake. The data you are recording is "Aircraft". The era to
  217.      which they belong should simply be another "Grouping" field.
  218.      If having saved your data you were asked for a list of all
  219.      "Boeing" military aircraft showing which wars they were used in
  220.      then this could be achieved with one simple procedure if they
  221.      were in one form but would be rather more difficult if they
  222.      were in two.
  223.      That example was fairly obvious but on many occasions it will
  224.      be easy to assume that two or more sets of data are separate
  225.      when in fact they are simply groups of the same.
  226.      Should you decide to write your own accounting program (Which
  227.      is not as daunting a task as it might seem on the surface) You
  228.      might be tempted to create forms for a Sales Ledger, Nominal
  229.      Ledger and Customers Accounts. In fact the entries in the
  230.                                  - 4 -
  231. ................................................................................
  232.      Nominal Ledger and Customers Accounts are simply sub groups of
  233.      the entries in the Sales Ledger. Provided that you include
  234.      grouping fields for the customers account number and nominal
  235.      account name you can construct customers and nominal accounts
  236.      when required by extracting and totalling the sub sets. There
  237.      is no need to save them as separate data.
  238.      The final problem you will encounter when deciding how to store
  239.      data is that of "Related Lists".  Consider the "Aircraft" form.
  240.      If you had a grouping for "Airliner" you might wish to record
  241.      all the airlines which operate each aircraft. You cannot just
  242.      add fields to the "Aircraft" form - One airliner might only be
  243.      operated by one airline and another might be operated by fifty.
  244.      To store this data you need another form let's call it Userlist
  245.      with fields "Aircraft" , "Airline" and "Uni" which is the
  246.      unique field derived by joining the other two. The "Aircraft"
  247.      field is looked up from the "Aircraft" forms unique field
  248.      "Knownas" and the "Airline" field is looked up from the
  249.      "Airlines" form "Name" field which is also unique.
  250.      In this form you enter one record for each combination of
  251.      aircraft and airline. When you come to report on your data you
  252.      can list single records from the main "Aircraft" form together
  253.      with all related records from the "Userlist" form.
  254.      ...................PROCEDURE CODE.............
  255.      declare output fields
  256.         aircraft.knownas : Aircraft.production :aircraft.seats
  257.         userlist.airline
  258.      end
  259.      for aircraft with knownas = input.knownas
  260.         print formfields
  261.         for userlist with aircraft = aircraft.knownas
  262.            print userfields
  263.         next
  264.      next
  265.      ...................FORMAT.....................
  266.      .formfields
  267.                        { Aircraft.knownas field }
  268.            Production { Prodn. field}    Seats  {Seats field }
  269.                              Operated by :-
  270.      .userfields
  271.                       { Userlist.Airline field  }
  272.      .end
  273.                                  - 5 -
  274. ................................................................................
  275.                              FORM DESIGN
  276.      To start designing your forms select "Form Design" then "Design
  277.      new Form" from the menu system.  You are presented with a blank
  278.      form. Each form has four pages. To move from one page to the
  279.      next use the PgDn and PgUp keys. To move the cursor around on a
  280.      page use the arrow keys. Designing your form is a bit like
  281.      designing a form on paper. If you were to type on a paper form-
  282.               Name     .................
  283.               Address  .................
  284.                        .................
  285.                        .................
  286.                        .................
  287.      Then in Easy Base you type Name and Address as above but
  288.      instead of typing the dots you define fields for the data to be
  289.      entered to.
  290.      Easy Base provides several facilities for "Polishing" the
  291.      presentation of your forms and these are covered first before
  292.      moving on to field definition.
  293.      If you wish to enclose your text within boxes or in some
  294.      tabular format Press F3 and select "Line Drawing".  To draw
  295.      lines on the screen hold down the Alt key, The Ctrl key or both
  296.      and drive the cursor around with the arrow keys. The Alt key
  297.      draws double thin lines, the Ctrl key draws single thin lines
  298.      and a combination of both draws a thick single line. Press Esc
  299.      when you are finished line drawing to return to normal editing.
  300.      If you wish to shade areas of the screen then again press F3
  301.      and select "Shading". Shading works much the same as Line
  302.      Drawing.
  303.      If you require Greek, Mathematical or International characters
  304.      which cannot be typed directly from the keyboard then press F3
  305.      and select either "Greek and Mathematical" or "International" A
  306.      menu of all such characters provided by your PC will appear.
  307.      The one you select is printed to your form at the cursor
  308.      position.
  309.      If you wish to use other than the default text colour then
  310.      press F4 after you have typed your text. In each Easy Base
  311.      screen colour set you can select one of two alternate text
  312.      colours or "Blink" - choose 1, 2 or 3 .  To change the colour
  313.      of your text or lines just hold down the shift key and drive
  314.      the cursor over the text you want to change with the arrow
  315.      keys. Press Esc when you have finished colouring your form.
  316.      Text input in the form designer has "overtype" as the default.
  317.      If you wish to move text (or fields) to the right press the
  318.                                  - 6 -
  319. ................................................................................
  320.      Ins key. Insert mode is indicated by a block cursor and
  321.      Overtype by an underscore cursor. (This is the opposite to all
  322.      other editors in Easy Base as it keeps the underscore cursor as
  323.      the default)
  324.      To insert a blank line above text or fields press F1. You
  325.      cannot scroll text or fields between pages in form design.
  326.      If you need to move areas of your form then press F9, shade the
  327.      rectangle you wish to move and move it around with the arrow
  328.      keys. You can also transport the rectangle between pages with
  329.      the PgUp and PgDn keys.  F9 can also be used to erase areas of
  330.      the screen.
  331.      When you are ready to define the data fields, position the
  332.      cursor where you want the field to start and press F10.
  333.      A window opens into which you enter all the attributes for the
  334.      field.
  335.      The first attribute is "Field Name". If you have typed text to
  336.      the left of the field then Easy Base will have inserted this as
  337.      a default in the Field Name attribute. If it's not the name you
  338.      want just edit it. When you are happy with the field name press
  339.      return or the down arrow to the "Data Type" attribute. A menu
  340.      appears with the nine different field types. (The field types
  341.      are described fully in the Programmers Reference)
  342.      When you have chosen a field type the cursor automatically
  343.      moves down to the "Field Length" attribute if you have chosen
  344.      "Text", "Integer", "Fixed Point" or "Floating Point" and to the
  345.      "Mandatory Entry" attribute if you have chosen one of the
  346.      others. Enter the field length you require in characters. If
  347.      you have chosen "Fixed Point" as the field type there are two
  348.      entries, one for the digits left of the decimal point and one
  349.      for the digits right of it. If your field is to hold a currency
  350.      value then the second entry will of course be 2.
  351.      You must supply values for the first three field attributes.
  352.      The others all have preset defaults so you can save your field
  353.      at this point if none of the others have to be changed.
  354.      The next Field Attribute is "Mandatory Entry" which has a
  355.      default of "No".  You can set this to "Yes", "No" or "If". If
  356.      you set it to "Yes" then Easy Base will not allow a record to
  357.      be filed with this field left blank.  If you set it to "If"
  358.      then the "Code Snippet" editor opens up and you can enter the
  359.      condition under which an entry becomes mandatory. If you were
  360.      designing a "Payments" form and one of the fields "Paymethod"
  361.      could be filled with either "Cash" or "Cheque". Then the field
  362.      "ChequeNo" would have to be filled only if the "Paymethod"
  363.      field had "Cheque" entered in it.  To make an entry mandatory
  364.                                  - 7 -
  365. ................................................................................
  366.      in the "Chequeno" field only if "Paymethod" is "Cheque" enter -
  367.      paymethod = "cheque" in the Code Snippet editor.
  368.      When you use the Code Snippet editor for Mandatory Entry and
  369.      for User Entry, only the condition is entered :-
  370.            total < 100
  371.            name = blank
  372.            length = blank or breadth = blank
  373.      the "if" is assumed.
  374.      If you set the "Mandatory Entry" attribute to either "Yes" or
  375.      "If", a window will open into which you can type the message
  376.      which you wish to be displayed should an attempt be made to
  377.      file a blank entry.  If you leave the message blank Easy Base
  378.      will supply the default message "This field must be filled !".
  379.      The next attribute is "Unique". This can be set to "Yes" or
  380.      "no".  You can only have one unique field on a form. If you
  381.      have already defined a field as the unique field and you change
  382.      your mind and define another then Easy Base will automatically
  383.      cancel the unique attribute on the first field.  Indexing is
  384.      automatically set to "Yes" for the unique field.
  385.      The next attribute is "Indexed". Select "Yes" or "No"
  386.      When you set "Index" to "yes",  Easy Base Creates a separate
  387.      "Index" file in which the contents of the field are kept in up
  388.      to date order. Index files are used by Easy Base in exactly the
  389.      same way that you would use an index in a book to find things
  390.      quickly.
  391.      The next attribute is "User entry".  This has a default of
  392.      "Yes" but can be set to "No" or "If".  If you set this
  393.      attribute to "No" then the cursor will not visit the field
  394.      during record entry so the user cannot alter its contents. You
  395.      would normally set this to "No" if the contents are derived or
  396.      calculated from the values of other fields. You can set this
  397.      attribute to "If" if the value entered in another field makes
  398.      this one superfluous. For example, in the "Aircraft" form, if
  399.      you had a field "Passengers" and the type had been entered as
  400.      "Fighter" there would be no point in the cursor moving to the
  401.      "Passengers" field.  When the Code Snippet editor opens you
  402.      could type:-
  403.            type = "Transport" or type = "Airliner"
  404.      The next field attribute is "Display".   When the cursor
  405.      reaches this attribute a menu appears with the seven different
  406.      ways in which the field can be displayed.
  407.                                  - 8 -
  408. ................................................................................
  409.      The field display attribute settings have the following
  410.      meaning.
  411.      1.  FIELD
  412.          The field's size is displayed as a block which shows
  413.          up against the screen background.
  414.      2.  TEXT
  415.          The field size does not show up against the screen
  416.          background and the contents are in the default text colour.
  417.      3.  1ST ALT COL.
  418.          As Text but with the contents in the first alternate colour
  419.      4.  2ND ALT COL
  420.          As Text but with contents in the second alternate colour.
  421.      5.  BLINKING
  422.          As Text but the contents blink.
  423.      6.  INVISIBLE
  424.          Neither the size nor the contents can be seen.
  425.          Invisible fields are used to hold compound index fields and
  426.          the results of intermediate calculations which the user
  427.          need not see.
  428.      7.  CODEWORD FIELD
  429.          The size of a codeword field shows against the screen
  430.          background but its contents are masked by stars.
  431.          Codeword fields are used to collect passwords for
  432.          restricted menus or procedures. An onlooker cannot see the
  433.          password which is being entered.
  434.      The final field attribute is "Derived". If you set this to
  435.      "yes" then the Code Snippet editor opens and you can enter the
  436.      formula by which the fields contents are to be derived.
  437.      In the Code Snippet editor you can enter almost any derivation
  438.      formula. Formulae consist of field names operators and
  439.      functions.
  440.         price * markup
  441.         VATon(net,vatrate)
  442.         datetext(system date)
  443.         if(sex = male,"Mr","Ms")
  444.                                  - 9 -
  445. ................................................................................
  446.      All the operators and functions are fully described with
  447.      examples of how they are used in the Programmers Reference.
  448.      If in the Code Snippet editor you cannot remember a field or
  449.      function name then Press F1 for the reminder lists.
  450.      There is a cut and paste facility in the Code Snippet editor.
  451.      To mark text hold down the shift key and move the cursor with
  452.      the arrow keys. When you release the keys the "Cut" or "Copy"
  453.      choice will appear. To paste text, position the cursor at the
  454.      insertion point and press Shift + Ins.  Text which is cut or
  455.      copied from the derivation of one field can be pasted into the
  456.      derivation of any other field in any other form.
  457.      When you have finished entering the field attributes press F2
  458.      to save the field. When you have defined all the fields press
  459.      F2 to save the form.
  460.      There is one other facility in the Form Design editor.  If you
  461.      press F5 at any time you enter "Derivation Test Mode".  In
  462.      derivation test mode you can enter data to your fields and
  463.      check if your derivations work correctly.  Any fields which you
  464.      have defined as invisible are not hidden in test mode.  The
  465.      main advantage of test mode as opposed to testing in Record
  466.      Entry comes not when you are designing new forms but when you
  467.      wish to modify one after you have saved many records in it.  If
  468.      you add, delete or alter the length of a field then the entire
  469.      data file has to be reformatted and this takes time.  With
  470.      "Derivation Test Mode" you can ensure that the modifications
  471.      you have made are correct before reformatting.
  472.      The only exception to test mode is if you have added a new
  473.      lookup function and you have not yet entered the relationship.
  474.      If you select test mode with a relationship missing you will
  475.      get an error message and be returned to Form Design.
  476.      When you save your form Easy Base tests it in derivation test
  477.      mode before saving. If it cannot find a relationship you will
  478.      be given an error message and offered the choice to remain in
  479.      Form Design (which you would do should you know that the
  480.      relationship exists and you must therefore have mistyped a
  481.      lookup formula) or to save and go to the relationships form
  482.      Which you would do if the relationship had not yet been
  483.      entered)
  484.      If you opt to go to Relationships Easy Base will transfer you
  485.      to the relationships form and back again via a macro.
  486.                                  - 10 -
  487. ................................................................................
  488.                  RELATIONSHIPS AND THE LOOKUP FUNCTION
  489.      In Easy Base the Lookup Function together with pre-recorded
  490.      relationship links provide two of the most important facilities
  491.      of a data management system.
  492.          1. Reuse of previously entered data.
  493.          2. Verification of text data.
  494.      Consider the situation where you have designed a form to hold
  495.      information about your business's customers. The form has an
  496.      "accountno" field which has been derived as "Sequence" and this
  497.      is therefore the "Unique" field on the form.  It also has
  498.      fields "Name" and "Address".  All your customers have now been
  499.      recorded in this form.  You now want to create an invoice form.
  500.      Each invoice issued will have to have a customer's name and
  501.      address entered on it.  All the names and addresses are already
  502.      filed in Easy Base so they do not have to by typed again.
  503.      Provided that Easy Base knows which customer's name and
  504.      address is required it can copy it automatically from the
  505.      "Customers" form to the "Invoice" form.
  506.      The way in which Easy Base accomplishes this is exactly the
  507.      same as you would accomplish the task manually in a hand
  508.      written system. If you knew where to find the book in which
  509.      your customers names had been written and you knew the
  510.      customers account number then you could find the customers name
  511.      and address.
  512.      The only slight difference for the computer is that while you
  513.      would consider it "Obvious" that the account number on the
  514.      invoice would be the same as the account number in the
  515.      addresses book your computer does not - You have to tell it.
  516.      To tell Easy Base where to look and that the "accountno" is the
  517.      link, you enter a record in the "Relationships" form.
  518.      When you select "Relationships" from the main menu you will see
  519.      five fields to be filled.  The first field is the name of the
  520.      form which data is to be copied to. In this case you will enter
  521.      "Invoices".  You will notice that easy base has displayed a
  522.      list of all your form names and that you must choose one.  You
  523.      cannot enter the name freehand.  This "internal" data
  524.      verification is the same as you will be doing for your own data
  525.      later.
  526.      The second field is for the name of the form in which the data
  527.      can be found.  In this case select "Customers".
  528.      The next two fields record which fields in the primary and
  529.      secondary form hold the "Linking" data. In this case select
  530.      "acountno" in both.
  531.                                  - 11 -
  532. ................................................................................
  533.      The final field is the name of the relationship record.  You
  534.      will notice that Easy Base has already entered a default name
  535.      of "Customers".  The relationship name can be anything you like
  536.      but as the "Lookup" function which you are about to use quotes
  537.      the relationship name as its first parameter and the field to
  538.      be copied as its second then Lookup(customers,name) has to be
  539.      more meaningful and easy to remember than any other name you
  540.      could give.
  541.      When you have entered all the fields press F2 to save the
  542.      relationship, return to Form Design and load your "Invoice"
  543.      form.
  544.      All that remains to do now is edit the field attributes of the
  545.      "Name" and "address" fields.  To edit a field you can either
  546.      press F10 with the cursor on the form background and select the
  547.      field to edit by name, or you can position the cursor within
  548.      the field you wish to edit and then press F10, in which case
  549.      the field attribute window will open automatically.  Position
  550.      the cursor in the "Name" field and press F10. Move the cursor
  551.      to the "Derivation" attribute and set it to yes. (you can move
  552.      the cursor from the "Name" attribute directly to the "Derived
  553.      attribute by pressing the up arrow)
  554.      When the Code Snippet window opens type -
  555.           Lookup(customers,name)
  556.      and press F2.  If you had not already done so then set the
  557.      "User Entry" attribute to "No".
  558.      Press F2 to save the new field attributes and then do the same
  559.      for the "Address" field, this time entering the derivation -
  560.          Lookup(customers,address)
  561.      To test that you have typed the lookups correctly press F5 for
  562.      Derivation Test Mode. Enter a customers account number in the
  563.      "Acountno" field and press the return key. If your formulae are
  564.      correct the customers name and address will appear in the
  565.      "Name" and "Address" fields.
  566.      In this example you have performed two "Secondary" lookups.
  567.      Both the "Name" and "Address" fields were found using the
  568.      "accountno" link which you had to enter correctly in order
  569.      to find the other two fields.
  570.      The real power of the Lookup function is only realized when you
  571.      perform "Primary" and "Secondary" lookups.  In a "Primary"
  572.      lookup the field whose value is to be looked up is also the
  573.      "Link".  It is "Primary" lookups which are used for data
  574.      integrity checking.
  575.                                  - 12 -
  576. ................................................................................
  577.      Consider the "Aircraft" and "Manufacturers" forms which were
  578.      discussed earlier.  Suppose that you want to lookup the
  579.      manufactures name and the name of his base airfield into the
  580.      "Aircraft" form.  The definition field in the "Manufacturers"
  581.      form is "Name" - There is no handy "accountno".  You are going
  582.      to have to enter a relationship between "Aircraft" and
  583.      "Manufacturers" linking the two fields "Manufacturer" in the
  584.      "Aircraft" form with "Name" in the "Manufacturers" form.
  585.      Having done this you could derive the "Base" field in the
  586.      "Aircraft" form with - Lookup(manufacturers,base) - and it
  587.      would be looked up when you entered the manufacturers Name just
  588.      as in the invoice example.  But what of the "Manufacturers"
  589.      field itself.  Was the name you entered in the manufacturers
  590.      form "A.V.Roe", "A.V.Roe & Co." or "AVRO A/C Co.".
  591.      Easy Base provides a simple solution to this problem.
  592.      Having entered the relationship, return to Form design and
  593.      enter the lookup derivations. Derive the "Base" field with -
  594.          Lookup(manufacturers,base)
  595.      and the "Manufacturers" field with
  596.          Lookup(manufacturers,name)
  597.      This time, leave the "User Entry" attribute set to "Yes" in the
  598.      "Manufacturers" field.
  599.      Press F5 for "Test mode".  When the cursor enters the
  600.      "Manufacturers" field type -  AV*  - and press return.
  601.      Provided there is only one manufacturer whose name begins with
  602.      "AV" the Avro name will be looked up into the "Manufacturers"
  603.      field and its representation will always be exactly the same as
  604.      the original entry in the "Manufacturers" form.  If there are
  605.      several manufacturers whose names begin with "AV" then a menu
  606.      will appear listing all of them and you can choose the one you
  607.      want. As soon as you select the name the secondary lookup
  608.      "Base" will fill automatically.
  609.      If you cannot remember the first letters of the name you want
  610.      to look up - say for example that you could only remember that
  611.      "Roe" was in the name - then type Roe* and press return.  If
  612.      any manufacturers names begin with "Roe" they will be displayed
  613.      first. If not Easy Base will fill the "Manufacturer" field with
  614.      the first name it finds with the letters roe in it.  If this is
  615.      not the one you want press F3.  Each time you press F3 Easy
  616.      Base will find the next name containing the letters until you
  617.      find the one you want.   As a final resort - if you really
  618.      can't remember what you are looking for - just enter an "*" on
  619.                                  - 13 -
  620. ................................................................................
  621.      its own and press return. Easy Base will then list all the
  622.      manufacturers names for you to choose from.
  623.      There is no limit to the number of secondary lookups which can
  624.      be made from each primary and there is no limit to the number
  625.      of different forms you can look data up from.
  626.      If you have many different forms which all look up data from
  627.      the "Customers" form then they can all use the same
  628.      relationship name "Customers" but if you have more than one
  629.      relationship between the same two forms then they must have
  630.      different names.
  631.      If you had a "Stock" form with the unique field "Item" and
  632.      another field "Price" then you could add four fields to your
  633.      "Invoice" form - "Item", "Quantity" "Price" and "Total".
  634.      You would enter a relationship "Stock" between "Invoice" and
  635.      "Stock" with the related fields being "Item" in both forms.
  636.      In your invoice form you would derive :-
  637.         Item as    Lookup(stock,item)
  638.         Price as   Lookup(stock,price)
  639.         Total as   quantity * price
  640.      When you entered the "Item" field (primary lookup) the price
  641.      field would fill automatically and when you entered the
  642.      "Quantity" the "Total" field would be calculated.
  643.      However, if you now add four more fields "Item2", "Price2",
  644.      "Quantity2" and "Total2" you will need another relationship
  645.      between "Invoice" and "Stock" this time linking "Item2" in the
  646.      "Invoice file" with "Item" in the stock file and you cannot now
  647.      use the default name "Stock" for the relationship.
  648.      Although you can give your additional relationship any name you
  649.      like, the best name will be "Stock2".
  650.      Please note that this example is used purely to show the use of
  651.      multiple relationships between the same two forms.  If you are
  652.      intending to write an invoicing system then unless you know
  653.      that there will only be a limited number of items on each
  654.      invoice this is not a practical way to tackle the problem.
  655.      In a flexible invoicing system each item and quantity is
  656.      entered via a procedure to a temporary list form whose contents
  657.      are then printed to the invoice.
  658.      From V9 the lookup function also accepts a third parameter with
  659.      which you can specify the display of a field other than that
  660.      which is being looked up. See "Lookup" in Programmers Reference
  661.                                  - 14 -
  662. ................................................................................
  663.                                DATA ENTRY
  664.      As soon as you have designed forms you can enter and view data
  665.      directly using the default screen you created.  To enter data
  666.      to a form select "Data Entry" from the main menu and choose the
  667.      form you wish to use.
  668.      Your default entry screen will appear with the cursor in the
  669.      top left field. The top line of the screen shows the name and
  670.      page number of the form you are using together with the system
  671.      date and time. Line 2 shows the number of the record you are
  672.      creating or editing on the left hand side. It is also the line
  673.      on which any error messages are passed. The bottom line lists
  674.      the most used function keys and is also the line on which help
  675.      prompts are displayed.
  676.      To move the cursor around between fields you can use all of the
  677.      cursor control keys which work as follows:-
  678.      The Return key moves from field to field in the order top left
  679.      to bottom right unless you have overridden this in form design
  680.      by deriving fields with "Goto (fieldname) Next".
  681.      The Tab key moves the cursor from field to field in the order
  682.      bottom right to top left (reverse of Return).
  683.      The arrow keys move the cursor in the direction indicated.
  684.      The Home Key moves the cursor to the beginning of the current
  685.      field if it is not already there and to the first field on the
  686.      page if it is.
  687.      The End Key moves the cursor to the end of text if it is in a
  688.      text field and to the last field on the page if it is not.
  689.      The PgUp and PgDn Keys move between pages if your form has more
  690.      than one.
  691.      When you have entered the data for your first record press F2
  692.      to save it to disk. The screen will clear, the message "Record
  693.      1 has been added" will appear briefly on line two and you will
  694.      be ready to enter the next record.
  695.      If some of your fields are primary lookups then you use them
  696.      exactly the same as was described for "Derivation Test Mode" by
  697.      entering part of the text followed by a star and pressing the
  698.      Return Key.
  699.      Once you have saved a few records to disk you may wish to view
  700.      or edit them. You can bring previously entered records back to
  701.      the screen for editing in several ways.  From record creation
  702.      the F5 Key brings up the first record and subsequent presses
  703.                                  - 15 -
  704. ................................................................................
  705.      bring up the next record. Similarly, from record creation the
  706.      F4 Key brings up the last record and subsequent presses bring
  707.      up the previous record.
  708.      Once you have entered several records this process becomes
  709.      impracticable and you "search" for the record you wish to view
  710.      or edit.  Position the cursor in any field and type part of the
  711.      field contents you wish to search for followed by a star and
  712.      press F3.
  713.      Searching for records within a form is a similar process to
  714.      looking up data except that you press the F3 rather than the
  715.      Return Key to initiate the process. If the field in which you
  716.      are searching is indexed and more than one record matches the
  717.      data you have entered then Easy Base will make a list of all
  718.      the field contents which match for you to choose from.  If the
  719.      field is not indexed then Easy Base will bring up the first
  720.      record it finds a match in. If this is not the record you want
  721.      then press F3 again. Easy Base will find another match on each
  722.      successive press of the F3 key until you find the record you
  723.      want. As with lookups, Easy Base will search for "Part Matches"
  724.      after it has exhausted all the records where the entered data
  725.      matches the beginning of the field and if you enter a star on
  726.      its own and press F3, Easy Base will list all the field
  727.      contents for you to choose from.
  728.      When you have brought a previously entered record back to the
  729.      screen you will notice that line 2 now displays "Editing Record
  730.      x of y " rather than "Creating New Record x ".  Easy Base
  731.      automatically changes from "Create" to "Edit" mode when you
  732.      view a record.  The changes which you make on screen are not
  733.      entered to the record on disk until you press F2.
  734.      To clear the contents of the field in which the cursor lies
  735.      rather than delete each character press F6. To return to
  736.      "Create" mode press F6 twice.
  737.      Not all of the active function keys are listed on the prompt
  738.      line. To see a full menu of the function key uses press F1 for
  739.      the Function Key Menu.  The following is a summary of the
  740.      function key usage in Data Entry:-
  741.      F1
  742.      The F1 Key brings up the function key Menu.
  743.      F2
  744.      The F2 Key writes a new record from "Create" and updates the
  745.      record on screen from "Edit" mode.
  746.                                  - 16 -
  747. ................................................................................
  748.      F3
  749.      The F3 key initiates searches for previously entered records
  750.      based on the data entered in the current field.
  751.      F4
  752.      The F4 key moves to the previous record when in "Edit" mode and
  753.      to the last record from "Create" mode.
  754.      F5
  755.      The F5 Key Moves to the next record when in "Edit" mode and to
  756.      the first record from "Create" mode.
  757.      F6
  758.      The F6 key clears the current field on the first press and
  759.      returns you to "Create" mode on the second press.
  760.      F7
  761.      The F7 key deletes the record currently on screen in "Edit"
  762.      mode.  When you delete a record with the F7 key it is not
  763.      actually erased from the disk. It is simply "Flagged" for
  764.      deletion at the next "Pack" operation. If you delete a record
  765.      accidentally you can reinstate it any time before the form is
  766.      next packed.
  767.      F8
  768.      The F8 key creates a new record by copying the record currently
  769.      on screen. If a new record you wish to create contains similar
  770.      data to one already entered then you can find the previous
  771.      entry, change the unique field and copy it with F8 rather than
  772.      type it all again.
  773.      F9
  774.      If you know the number of the record you wish to view or edit
  775.      you can press F9 and enter the record number. Easy Base will
  776.      then bring the record whose number you have entered to the
  777.      screen.
  778.      F10
  779.      When you press the F10 key Easy Base searches for records which
  780.      are "Flagged" for deletion.  When it finds one it will bring it
  781.      to the screen. You can reinstate a deleted record by pressing
  782.      F2 while it is on screen. The F5 key searches for the next
  783.      deleted record and the Escape key returns you to "Live
  784.      Records".
  785.                                  - 17 -
  786. ................................................................................
  787.      F11
  788.      If you have been viewing records and you wish to return to one
  789.      which you had on screen earlier then press F11 and Easy Base
  790.      will back step through the records you have viewed.
  791.      F12
  792.      The F12 key brings up the form's "Options". There are four
  793.      options in Data Entry.
  794.         1. Clear screen on Adding Record.             (Default Yes)
  795.         2. Confirmation Required to delete Records.   (Default Yes)
  796.         3. Confirmation Required to abandon Edits     (Default No)
  797.         4. Clear Field on Editing                     (Default No)
  798.      If you change "Clear Screen on adding Record" to "No" then,
  799.      when you press F2 to file a new record, the data which is
  800.      written to disk remains on screen ready for the next new
  801.      record. This is useful if you are entering several records and
  802.      many of the fields in each record contain the same data. You
  803.      only have to overwrite the fields which are different each
  804.      time.
  805.      If you have many records to delete then set option 2 to "No"
  806.      and you will be able to delete them without having to confirm
  807.      each one.
  808.      If you set option 3 to "Yes" then Easy Base will ask you to
  809.      confirm that you wish to leave a record which you have edited
  810.      but not updated to disk.
  811.      If you set option 4 to "Yes" then Easy Base will clear the
  812.      old contents of any field you start to edit.  This is most
  813.      useful when used in conjunction with option 1. You can file a
  814.      record, retain the contents for the next record and when you
  815.      edit the fields which are different you do not have to first
  816.      delete the data in them.
  817.      The options you set for any given form remain with it until
  818.      changed. They do not revert to the defaults when your computer
  819.      is turned off and each form can have different option settings.
  820.      Ctrl + E
  821.      If you press the "E" key while holding down the Ctrl key you
  822.      will get the extended "Greek" and "International" characters
  823.      menu which was discussed in form design.
  824.                                  - 18 -
  825. ................................................................................
  826.      Ctrl + S
  827.      If you press The "S" key while holding down the Ctrl key you
  828.      start the Spell-checker.  The Spell-checker will check the
  829.      current field. If it finds a word not included in the Easy base
  830.      dictionary it will offer you the choices to leave the word and
  831.      continue, add the word to the dictionary, or choose one of the
  832.      suggestions for replacement.
  833.      The Spell checker does not automatically move from field to
  834.      field but once you have started it, it remains active and will
  835.      immediately check the next text field you move the cursor to.
  836.      The Spell-checker is cancelled if you press the Escape key or
  837.      if you press the F2 key to update the record.
  838.                                  - 19 -
  839. ................................................................................
  840.                         PROCEDURES (REPORTING)
  841.      The Easy Base procedure generator is the means by which you
  842.      manipulate and report on your data.
  843.      Each procedure has at least one part, the procedure code.  The
  844.      procedure code contains the instructions you write to tell Easy
  845.      Base what you want done.
  846.      If your procedure has an "output", in other words your
  847.      instructions tell Easy Base to send data to the screen or to
  848.      the printer, then the procedure must also have an Output
  849.      Format. The Output Format is where you show Easy Base how you
  850.      want the data you are about to "output" arranged on the screen
  851.      or page.
  852.      If what your procedure is to do depends on variables, ie it
  853.      requires information from the operator or from Looked up data
  854.      from one or more of your forms then it also requires an "Input
  855.      Screen".  The Input Screen is where you gather the variable
  856.      information that your procedure needs in order to carry out its
  857.      task.
  858.      Select "procedures" from the main menu and have a look at the
  859.      items on the procedures menu.
  860.      You will notice that the menu has pre-selected item 2 "Load
  861.      Existing Procedure". Other than your first procedure this is
  862.      the most useful starting point.  Item 1, "Create New Procedure"
  863.      is only required if you wish to start a new procedure after you
  864.      have another one loaded. The three parts to a procedure
  865.      mentioned above are created and edited at items 3,4 and 5.
  866.      Procedures, like forms, are saved to disk and can be re-used
  867.      repeatedly. Item 6 runs the current procedure and item 7 saves
  868.      it to disk.
  869.      Item 8 deletes procedures which are no longer required and Item
  870.      9 copies an existing procedure. Often you will require a
  871.      procedure which is similar to one you have already created. It
  872.      is much quicker to copy the first procedure and then edit it
  873.      than to start a new procedure from scratch.
  874.      Item 10 recalls the last output from a procedure to the screen.
  875.      If you need to see the output from a procedure but it is not
  876.      imperative that you have the most up to date information,
  877.      (close of business / month end figures Etc) then it is much
  878.      quicker to view the last output than to re-run the procedure.
  879.      Finally, a small window just below the menu shows the name of
  880.      the currently loaded procedure. In this case it is "Untitled".
  881.                                  - 20 -
  882. ................................................................................
  883.      If you have not already done so, read the descriptions of the
  884.      Declare, For..Next, If..Then, Print and Printer Control
  885.      commands in the Programmers Reference now. These are the basis
  886.      of all "reporting" procedures and should be thoroughly
  887.      understood. If you are a programming beginner then some of the
  888.      examples in the For..Next section may seem a bit advanced -
  889.      Just ignore them - for the moment it is only important that you
  890.      understand the principle of the loop and the qualifications
  891.      that can be applied to it.
  892.      Now select item 4 to write your first Procedure Code.
  893.      The next few pages will describe simple reporting procedures
  894.      based on the "Aircraft" form. To write like procedures for the
  895.      forms you have designed all you have to do is substitute your
  896.      form and field names.
  897.      Before you start, have a look at the function key list on the
  898.      bottom line. F2 saves your code and checks it. If you press the
  899.      Escape key your code is still saved but the checking routine is
  900.      bypassed. If you have written code and find that it is not
  901.      passed on F2 because, for example, one of your form fields
  902.      needs to be indexed, then you can still save the code you have
  903.      written while you modify the form.
  904.      F3 and F4 provide search and replace facilities similar to a
  905.      word processor.
  906.      There is a cut and paste system.  To mark code for cutting or
  907.      copying hold down the Shift key and shade the code with the
  908.      arrow keys.  As soon as you release the keys a menu will pop up
  909.      with three options - Cut, Copy or Indent. The cut and copy
  910.      options work exactly the same as in the Code Snippet editor
  911.      with Shift + Ins used to paste the text. If you select "Indent"
  912.      then you can indent all the selected lines at once with the
  913.      left and right arrow keys.
  914.      If you want to print out your code then press F10.
  915.      The F1 key, labelled "Help" is the key you use when you can't
  916.      remember something.  It has all the names of your forms, the
  917.      names of the fields in each form and the names of all Commands,
  918.      functions, and System values.  If Easy Base recognizes the
  919.      context of your procedure when you press F1 then it will list
  920.      the names you need (Formnames, fieldnames or Commands). If not
  921.      a menu will appear from which you can pick which you need.
  922.      With the cursor at the start of the top line on your blank
  923.      procedure screen press F1.
  924.      The "Commands" reminder list appears on the right hand side of
  925.      the screen.  The command you want is the first one , "Declare
  926.      Output Fields" but before selecting it have a look at how to
  927.                                  - 21 -
  928. ................................................................................
  929.      select from the reminder lists. There are over fifty commands
  930.      on this list but only the first seventeen are shown. You can
  931.      scroll though them with the arrow keys but you can also use the
  932.      inbuilt alphabetic search facility. If you type "o" then the
  933.      highlight bar will move directly to the "Odd Page Print"
  934.      command.
  935.      Take the highlight bar back to the "Declare Output Fields"
  936.      command either by scrolling or by pressing the Home key and
  937.      press return.  The command will be inserted on the first line,
  938.      the cursor will move to the second line and the "Forms"
  939.      reminder list will appear.  Select the form which you wish to
  940.      report on. In my example case this will be "Aircraft".
  941.      "Aircraft." is inserted on the second line and the "fields"
  942.      reminder list appears. I select "Knownas".  I also wish to list
  943.      the aircraft's mark and type so I write.
  944.      Declare output fields
  945.         Aircraft.knownas : Aircraft.mark : Aircraft.type
  946.      end
  947.      Declare the fields you wish to list either by typing them
  948.      freehand or by pressing F1 for reminders.
  949.      Now complete your procedure code:-
  950.      Declare Output fields
  951.         Aircraft.knownas : Aircraft.mark : Aircraft.type
  952.      end
  953.      for Aircraft
  954.         Print list items
  955.      next
  956.      and press F2 to check and save the code.
  957.      If you have typed everything correctly you will be returned to
  958.      the Procedures menu.  If you have misspelled something then the
  959.      line with the error will be highlighted and you will get an
  960.      error message. Correct the error and press F2 again.
  961.      Easy Base now knows that it is to list the three fields
  962.      Knownas, Mark and Type from all the records in the "Aircraft"
  963.      form.  It does not know how they are to be arranged or whether
  964.      they are to be printed or just shown on screen. This
  965.      information must now be recorded on the procedures "Output
  966.      Format".
  967.      Select item 5, "Output Format", from the procedures menu and
  968.      have a look at the screen. As usual the bottom line shows the
  969.      function key usage. To insert a blank line you use F1 as in
  970.      form design. F2 saves the format and the Escape Key abandons
  971.      it. F3 gives you a line drawing facility similar to that in
  972.                                  - 22 -
  973. ................................................................................
  974.      form design and Ctrl + "E" brings up the Greek and
  975.      International characters menu.  The F10 Key is used to place
  976.      your output fields.
  977.      The upper status line shows the paper size you have selected at
  978.      the left hand edge. If you scroll to the right it also shows
  979.      where the right hand edge of your paper will be at the three
  980.      different print sizes 10, 12, and 17 characters per inch.
  981.      On the right hand side of the screen a small menu will have
  982.      appeared offering you a choice of Format Section names. You do
  983.      not have to use one of these they are just to save you time.
  984.      For the moment select "List Items" from this menu.
  985.      .List items  will appear on the first line and the cursor will
  986.      move to the second.  For a first procedure we will simply list
  987.      the fields required in columns. To do this move the cursor in
  988.      along the second line to leave a reasonable margin and press
  989.      F10 to place the first field.  A menu appears listing the three
  990.      fields which were declared in the procedure's code. I select
  991.      "Aircraft.knownas".  As soon as The field has been selected a
  992.      window opens showing the default type and length of the field.
  993.      You can change these defaults if you wish the printed length or
  994.      type(for numeric fields) to be different in the report to what
  995.      it is in the form. This window also presents an extra attribute
  996.      marked "Trim Trailing Spaces" which defaults to "No". If you
  997.      set this to "Yes" then any blanks at the beginning or end of
  998.      the fields contents will not be printed at run time. This
  999.      facility is used mainly for inserting numbers or names into
  1000.      form letter text.
  1001.      Press F2 to accept the defaults. The area which the field will
  1002.      occupy is shown on screen. Now move the cursor to the right and
  1003.      place the other two fields. Finally, press the return key to
  1004.      take the cursor to a new line and type a full stop ".".  The
  1005.      section names menu appears again.  This time select "End".
  1006.      The format screen now looks like this.
  1007.      .List Items
  1008.           
  1009.      .End
  1010.      Press F2 to save the format. When you do, a new menu will pop
  1011.      up with four choices for the output destination. The exact
  1012.      meanings of these selections will be discussed shortly.  For
  1013.      the moment select "Output to Screen". When the Procedures menu
  1014.      appears select item 7 and save your procedure to disk.
  1015.      Now select item 6 and run the procedure.
  1016.      The fields from each record of the "Aircraft" form are listed
  1017.                                  - 23 -
  1018. ................................................................................
  1019.      down the screen. When the list reaches the bottom line the
  1020.      screen starts to scroll.  When all records have been listed the
  1021.      screen returns to the start of the list from where you can
  1022.      browse the report. If the list is long you can pause the output
  1023.      by pressing the return key while it is still running. Once the
  1024.      report is complete you can browse through it using the PgUp,
  1025.      PgDn and arrow keys.  You can also use the text search facility
  1026.      at F3.
  1027.      When you have finished reading the report press Escape to
  1028.      return to the procedures menu.  You can browse the report again
  1029.      at any time by selecting item 10 (Recall Last Output). Try it
  1030.      now.  While browsing a report you can also print it out by
  1031.      pressing F10.  If you press F10 to print a report from browse
  1032.      mode you invoke a low level print driver which prints the
  1033.      report at 10 CPI, 6 LPI in draft mode. Other font sizes and
  1034.      effects such as Bold and Underline are only available when you
  1035.      direct the report output to the printer at run time.
  1036.      To try printer effects select "Edit Procedure Code" and change
  1037.      The code to:-
  1038.      Declare output fields
  1039.         Aircraft.knownas : Aircraft.mark : Aircraft.type
  1040.      end
  1041.      Bold on
  1042.      12 CPI
  1043.      for aircraft
  1044.         print list items
  1045.      next
  1046.      Save the new code and select "Edit Output Format". There is
  1047.      nothing to change in the format itself but when you press F2 to
  1048.      save it, this time choose "Choose at Run time" for the output
  1049.      destination.
  1050.      When you now select "Run Procedure", the computer will beep and
  1051.      you will be asked whether the output is to be to the screen or
  1052.      printer. Choose printer and easy base will print your report in
  1053.      bold at 12 characters to the inch. (Assuming you have installed
  1054.      the correct printer driver from the utilities menu)
  1055.      You will notice that while Easy Base was printing your report
  1056.      it also output it to the screen but on completion it returned
  1057.      you to the procedures menu without invoking Browse mode.
  1058.      The output destinations which you choose when saving the output
  1059.      format are not "Either or" choices.  Irrelevant of your choice
  1060.      the output is always sent to both the screen and the disk file.
  1061.      It is the disk file that you browse when you select "Recall
  1062.      Last Output".  The differences between the choices are that
  1063.      only an output to the screen invokes Browse mode on completion
  1064.                                  - 24 -
  1065. ................................................................................
  1066.      and only an output to printer prints the report. Output to disk
  1067.      is only selected if you want to update reports from a Batch
  1068.      Execute menu.
  1069.      Now let's try something a bit more interesting. So far the
  1070.      report simply lists the aircraft in the order in which the
  1071.      records were filed.  To list them in alphabetic order, edit the
  1072.      procedure code and change the "For" line to:-
  1073.      for aircraft with knownas in order
  1074.      Save the code.  Easy Base can only list in order if the field
  1075.      you wish the order to be done by is indexed.  If the field you
  1076.      have chosen is not indexed you will get an error message.  If
  1077.      this happens, save the code by pressing the Escape Key - Save
  1078.      the procedure at item 7 then return to form design.  Load your
  1079.      form - edit the attributes for the field changing Indexed to
  1080.      "Yes".
  1081.      You can now reload your procedure and run it. This time the
  1082.      aircraft names will be in alphabetic order.
  1083.      Because a procedure has up to three parts it may not at this
  1084.      stage be obvious how Easy Base is handling the "Saving" or
  1085.      "Abandoning" of separate parts.  Here is a quick explanation.
  1086.      If you escape from either the output format or later the input
  1087.      screen and choose to "abandon" it you are abandoning it in the
  1088.      version of the report you are editing only. If you escape from
  1089.      the procedures menu and choose to "abandon" the procedure then,
  1090.      if it is a new "Untitled" procedure it is lost but if it is a
  1091.      procedure which you have loaded for editing then it is only the
  1092.      edits which are abandoned - The original procedure remains
  1093.      unchanged on disk. A procedure which you have loaded for
  1094.      editing is only changed on disk when you save it with item
  1095.      seven from the procedures menu.  At any time during the editing
  1096.      of a procedure you can throw away all your edits and return to
  1097.      the original version by reloading it from disk and replying
  1098.      "No" when you are asked if you wish to save the currently
  1099.      loaded version.
  1100.      Suppose now that we wished to list the aircraft in groups by
  1101.      type - all the bombers together - all the fighters together
  1102.      Etc.
  1103.      To do this, edit the procedure code again and change the "For"
  1104.      line to: -
  1105.      for aircraft with type in order
  1106.      This time, when the report is run, all the airliners come first
  1107.      followed by the bombers etc. but the group field "Airliner" ,
  1108.      "Bomber" etc. is listed on each line and it would be much
  1109.                                  - 25 -
  1110. ................................................................................
  1111.      neater if it could be separated or printed in Bold or
  1112.      underline.
  1113.      Edit the code again, this time to:-
  1114.      Declare output fields
  1115.         Aircraft.knownas : Aircraft.mark : Aircraft.type
  1116.      end
  1117.      declare variables
  1118.        lasttype as text
  1119.      end
  1120.      for Aircraft with type in order
  1121.         if aircraft.type <> lasttype then print group header
  1122.         lasttype = aircraft.type
  1123.         print list items
  1124.      next
  1125.      In this code we have introduced a text variable "lasttype".
  1126.      During the "For" loop the list items will be printed on each
  1127.      iteration but the group header will only be printed when the
  1128.      type changes
  1129.      Now edit the output format to:-
  1130.      .group header
  1131.          
  1132.      .list items
  1133.                  
  1134.      
  1135.      .end
  1136.      The group header starts with a blank line which will separate
  1137.      the groups. It contains only the "Type" field.  The list items
  1138.      section contains the "Knownas" and mark fields.
  1139.      When you run this report the output will be:-
  1140.         Airliners
  1141.                 Boeing 707
  1142.                 Dehaviland Comet     Mk4
  1143.                 Boeing Jumbo Jet     747
  1144.         Bombers
  1145.                 Boeing B52
  1146.                 Avro Vulcan
  1147.                 Avro lancaster       2
  1148.      If you want the group header to be in bold or underline then
  1149.      all you have to do is insert the on and off commands before and
  1150.      after the "Print group header" command using the block If then
  1151.      construction.
  1152.                                  - 26 -
  1153. ................................................................................
  1154.      Declare output fields
  1155.         Aircraft.knownas : Aircraft.type : Aircraft.mark
  1156.      end
  1157.      declare variables
  1158.         lasttype as text
  1159.      end
  1160.      for Aircraft with type in order
  1161.         if aircraft.type <> lasttype then
  1162.            bold on : underline on
  1163.            print group header
  1164.            bold off : underline off
  1165.         end if
  1166.         print list items
  1167.      next
  1168.      As a beginner, you are probably wondering about the reason for
  1169.      the indentations after the "for" and "if" lines. The code will
  1170.      work perfectly well without them. When you come to write more
  1171.      advanced procedures you will have many For loops, Do Loops and
  1172.      If conditions interwoven with each other.  If each has its own
  1173.      indentation then you will be able to see at a glance which
  1174.      commands occur within which loops and conditions and your code
  1175.      will be very easy to read and edit.
  1176.      Going back to the "Aircraft" listing procedure, we now have
  1177.      each group separated but the aircraft names themselves are no
  1178.      longer in alphabetic order.  This is because we changed index
  1179.      files when we selected "With Type in order".  It is now the
  1180.      "Type" groupings which are in alphabetic order.  Suppose that
  1181.      we want to keep this grouping but still list the aircraft in
  1182.      each group with their names in order.  Neither of the index
  1183.      files on the "Knownas" or "Type" fields can produce this order.
  1184.      We need a combined or "Compound" index on both fields
  1185.      To construct this index, save the present procedure and return
  1186.      to form design.  Load the "Aircraft" form and add a new field
  1187.      anywhere on it. Assuming the length of the "Knownas" field as
  1188.      45 and the length of the "Type" field as 14 the new fields
  1189.      attributes are:-
  1190.      Name         Typename
  1191.      Type         Text
  1192.      Length       59
  1193.      Mandatory    No
  1194.      Unique       No
  1195.      Indexed      Yes
  1196.      User Entry   No
  1197.      Display      Invisible
  1198.      Derived      Yes
  1199.      The derivation formula is:-
  1200.      Jointext(spacepad(type,15),knownas)
  1201.                                  - 27 -
  1202. ................................................................................
  1203.      Test that the derivation formula is correct by pressing F5 for
  1204.      test mode. When you type a name into the "Knownas" field and a
  1205.      type in the "Type" field the new field should derive as a
  1206.      combination of the two.
  1207.      Escape from test mode and press F2 to save the form. Easy Base
  1208.      will first re-format the data file to incorporate the new field
  1209.      and then write the new index file.
  1210.      When this is complete, return to the procedure and edit the
  1211.      "For line of the code from:-
  1212.      For aircraft with type in order
  1213.      to
  1214.      For Aircraft with typename in order
  1215.      No change is necessary to the output format.  The output will
  1216.      be laid out as before but the names in each group will be in
  1217.      alphabetic order.
  1218.      To "Polish" the "Aircraft" report it would be nice if it had a
  1219.      heading. We would also like to prevent the list from running
  1220.      off the end of the page when printed and add a page number at
  1221.      the foot of each page.
  1222.      To do these things edit the code to:-
  1223.      Declare output fields
  1224.         Aircraft.knownas : Aircraft.type : Aircraft.mark
  1225.         page number                  'New Field
  1226.      end
  1227.      Declare variables
  1228.         lasttype as text
  1229.      end
  1230.      bold on
  1231.      print report header
  1232.      for aircraft with typename in order
  1233.         if bottom margin < 1 then
  1234.            bold on : print page footer
  1235.            page feed : print page header : bold off
  1236.         end if
  1237.         if aircraft.type <> lasttype then
  1238.            bold on : underline on
  1239.            print group header
  1240.            bold off : underline off
  1241.         end if
  1242.         print list items
  1243.      next
  1244.      print report footer
  1245.                                  - 28 -
  1246. ................................................................................
  1247.      Now edit the output format to:-
  1248.      .Report header
  1249.          
  1250.                      AIRCRAFT LIST BY TYPE
  1251.          
  1252.      .Group Header
  1253.          
  1254.      .List Items
  1255.                  
  1256.      
  1257.      .Page header
  1258.          
  1259.                   Aircraft List By Type (Cont)
  1260.          
  1261.      .Page Footer
  1262.                              - 
  1263.      .Report Footer
  1264.          
  1265.      .End
  1266.      The new print sections Report Header, Report Footer, and Page
  1267.      Header contain only fixed text.  The new section Page Footer
  1268.      contains the new field "page number" and the "Trim trailing
  1269.      spaces" attribute should be set to "Yes" in this.  This will
  1270.      keep the correct spacing of   - 9 -    and   - 10 -    when the
  1271.      page numbers are printed.
  1272.      So far all the fields we have printed are from the same form
  1273.      "Aircraft".  Suppose that we also wanted to list the country of
  1274.      origin for each aircraft.  The "Aircraft" form does not hold
  1275.      this information but the "Manufacturers" form has a field
  1276.      "Nationality". To incorporate this field into the report all we
  1277.      have to do is declare it as an output field and then arrange to
  1278.      have that field in memory when we print the list items. We can
  1279.      load the correct record from the "Manufacturers" form by using
  1280.      the linking data "Name" in the manufacturers form and
  1281.      "Manufacturer" in the "Aircraft" form.  This is a similar
  1282.      process to looking up data except that a pre defined
  1283.      relationship is not necessary. We can tell Easy Base exactly
  1284.      what we want within the code.
  1285.      Declare output fields
  1286.         Aircraft.knownas : Aircraft.type : Aircraft.mark
  1287.         Manufacturers.nationality : Page number
  1288.      end
  1289.      Declare variables
  1290.         Lasttype as text
  1291.      end
  1292.                                  - 29 -
  1293. ................................................................................
  1294.      '.....................PRINT REPORT HEADING...
  1295.      print report header
  1296.      '.................
  1297.      for aircraft with typename in order
  1298.         '..................PRINT HEADERS AND FOOTERS...
  1299.         if bottom Margin < 1 then
  1300.            bold on : print page footer
  1301.            page feed : print page header : bold off
  1302.         end if
  1303.         '..................PRINT GROUP HEADERS.........
  1304.         if aircraft.type <> lasttype then
  1305.            bold on : underline on
  1306.            print group header
  1307.            bold off : underline off
  1308.         end if
  1309.         '...............LOAD MANUFACTURERS NATIONALITY..
  1310.         for manufacturers with name = aircraft.manufacturer
  1311.            Print list items
  1312.         next
  1313.         '..............
  1314.      next
  1315.      print report footer
  1316.      Because the procedure code is becoming longer, remarks are
  1317.      added to make it easier to see which parts of the code do what.
  1318.      You can add remarks to your code anywhere by prefixing them
  1319.      with an apostrophe.
  1320.      At the point where we are about to print the list items we
  1321.      start another "For" loop.  This time "For Manufacturers".  When
  1322.      one "For" loop is "Nested" within another, the record currently
  1323.      loaded by the first loop remains in memory while the records
  1324.      selected by the "Nested" loop are processed and all the fields
  1325.      of both records are available at the same time.
  1326.      As we have qualified the "Manufacturers" loop:-
  1327.      for manufacturers with name = aircraft.manufacturer
  1328.      only the single record in which the "Name" field matches the
  1329.      "Aircraft.manufacturer" field which is currently loaded by the
  1330.      outer loop will be selected from the "Manufacturers" form.
  1331.      While we have both the required records in memory we print the
  1332.      list items.
  1333.      All that remains to do now is to edit the output format and add
  1334.      the "Manufacturers.nationality" field to the .List Items
  1335.      section.
  1336.                                  - 30 -
  1337. ................................................................................
  1338.      By nesting loops in this way, you can list data from any number
  1339.      of different forms which have "Linking" data in one of their
  1340.      fields.  Where only one record matches as in the example above
  1341.      then the required fields go in the .List items section with the
  1342.      other fields.  Where there are many matches (Related list) the
  1343.      fields from the secondary loop have their own print section.
  1344.      (See example on page 5)
  1345.      Now we can print any of the fields from any "Related" forms in
  1346.      any order.  We are still, however, listing all the records from
  1347.      the "Aircraft" form and we may for example only wish to print
  1348.      those records which are in the "Bomber" group.
  1349.      Start a new procedure and enter the code:-
  1350.      Declare output fields
  1351.         Aircraft.knownas : Aircraft.type : Aircraft.base
  1352.      end
  1353.      for aircraft with type = "Bomber"
  1354.         print list items
  1355.      next
  1356.      Create the output format placing the three output fields within
  1357.      the .List Items section.
  1358.      When you run this report, only the bombers will be listed but,
  1359.      once more, the aircraft names will be in the order in which
  1360.      they were entered to the form.
  1361.      To get them in alphabetic order we must again use the compound
  1362.      index on the "Typename" field. This time we have to ensure that
  1363.      the loop starts with the first "Bomber" and ends with the last
  1364.      "Bomber".
  1365.      Declare output fields
  1366.         Aircraft.knownas : Aircraft.type : Aircraft.base
  1367.      end
  1368.      declare variables
  1369.         group as text
  1370.      end
  1371.      group = "Bomber"
  1372.      for aircraft with typename > "Bomber"
  1373.         if aircraft.type <> group then exit for
  1374.         print list items
  1375.      next
  1376.      Before starting the "For" loop we set a variable "Group" to the
  1377.      value "Bomber". The "For" loop is then qualified such that the
  1378.      records will be processed with "Typename" in order but starting
  1379.      with the first occurrence of "Bomber" in the field.  To stop
  1380.      the loop when all the bombers have been processed we test the
  1381.      contents of the "Aircraft.type" field on each iteration of the
  1382.                                  - 31 -
  1383. ................................................................................
  1384.      loop and when the first record is loaded which is not a bomber
  1385.      we stop processing the loop with the command "Exit For".
  1386.      As in the first procedure, we could now add Page headers, Page
  1387.      footers and number the pages Etc.
  1388.      Suppose however that having created this procedure we now
  1389.      wanted a list of all the "Airliners".
  1390.      We could achieve this by changing "Bomber" to "Airliner" within
  1391.      the code but this would be time consuming. It would be much
  1392.      better if we could tell Easy Base which type group we wanted at
  1393.      the start of the procedure and have Easy Base make the
  1394.      necessary changes.
  1395.      To supply "Variables" to a procedure before running we use an
  1396.      "Input Screen", the third part of a procedure.  Save the code
  1397.      and select item 3 (Create Input Screen) from the procedures
  1398.      menu.
  1399.      As soon as you select item 3 Easy Base will ask if you wish to
  1400.      copy an existing form. Type "N" for no.  The next screen will
  1401.      be familiar to you.  It is exactly the same as the form design
  1402.      screen.
  1403.      When you first designed your forms, the form design routine
  1404.      performed two tasks. It created your form and also a default
  1405.      input screen from which to enter data. Now that you are about
  1406.      to create input screens for procedures, the same routine is
  1407.      used to design the screen.  It does not, of course, create a
  1408.      parallel form.
  1409.      All the facilities for "Polishing" your forms - all the
  1410.      facilities for deriving, calculating looking up and testing
  1411.      derivations which you had in Form Design are also available for
  1412.      Input Screen design.
  1413.      The only difference you will notice is that when you define a
  1414.      field, the "Unique" and "Indexed" attributes are marked "Not
  1415.      Applicable" and when you run the procedure, only the "Options"
  1416.      "Clear Screen after Running Procedure" and "Clear Field on
  1417.      Editing" are available.
  1418.      Move the cursor to somewhere near the middle of the screen and
  1419.      type:- "Which Aircraft type would you like listed".  Then press
  1420.      F10 to define a field.
  1421.      If, in the aircraft form the "Type" field had been defined as a
  1422.      choice field, then we would define this field as a choice field
  1423.      and use the same list.
  1424.      If, on the other hand the "Type" field in the "Aircraft" form
  1425.                                  - 32 -
  1426. ................................................................................
  1427.      looked up its contents from a core data form containing the
  1428.      type names then we would set the attributes:-
  1429.      Name            type
  1430.      Data type       text
  1431.      Field Length    15    (Same as the "Type" field in "Aircraft")
  1432.      Mandatory       Yes
  1433.      User Entry      Yes
  1434.      Display         Field  (or text or Alt colours as you wish)
  1435.      Derived         No
  1436.      The field will of course be derived:- Lookup(Aircraft,type)
  1437.      but as we have not yet entered the relationship, we will leave
  1438.      the derived attribute set to "No" to prevent an error message
  1439.      when we save the screen.
  1440.      Save the screen.  When you do, you will be asked to select
  1441.      between "Repeat Screen after F2" and "Run Once and Exit".
  1442.      If you choose the first option then the procedure will repeat
  1443.      until you press the Escape Key. If you choose the second
  1444.      option, control will return to the procedures menu after the
  1445.      report has been run.
  1446.      Now save the procedure.  Let's call it "Aircraft By Type".
  1447.      You may have noticed that all Form, Field and Procedure names
  1448.      so far have been single words.  There is no restriction on
  1449.      using multiple words in names but single ones make code much
  1450.      easier to read. The only good reason to use more than one word
  1451.      is in a reporting procedure name. After the procedure has been
  1452.      run the status line in Browse mode will be "Procedure:-
  1453.      Aircraft By Type" which makes more sense to an end user than
  1454.      "Procedure:- ACbytyp".
  1455.      Now go to Relationships and enter the relationship "Aircraft"
  1456.      between "Aircraft by Type" and "Aircraft" linking the two
  1457.      fields "Type".
  1458.      Reload the "Aircraft by Type" procedure and edit the Input
  1459.      screen setting the derived attribute to "yes" and entering the
  1460.      derivation formula:-  Lookup(aircraft,type)
  1461.      Save the screen again and select "Edit Procedure Code".
  1462.      To use the Input screen quickly you could change the two
  1463.      occurrences of "Bomber" to input.type. However, now that we
  1464.      have an input.type field the variable "group" is superfluous.
  1465.      The finished procedure code and Output format are shown on the
  1466.      next page.
  1467.                                  - 33 -
  1468. ................................................................................
  1469.      Declare output fields
  1470.         Aircraft.knownas : Aircraft.base
  1471.         Page number : input.type
  1472.      end
  1473.      Print report header
  1474.      for aircraft with typename > input.type
  1475.         if bottom margin < 1 then
  1476.            print report footer
  1477.            page feed : print page header
  1478.         end if
  1479.         if aircraft.type <> input.type then exit for
  1480.         print list items
  1481.      next
  1482.      print report footer
  1483.      page feed
  1484.      ......................Output Format.........
  1485.      .Report Header
  1486.             
  1487.                           
  1488.  LIST
  1489.                           
  1490.                 Name                   Built at
  1491.             
  1492.      .Page header
  1493.             
  1494.                 Name                   Built at
  1495.             
  1496.      .List items
  1497.                 
  1498.      .Page Footer
  1499.                              - 
  1500.      .Report Footer
  1501.             
  1502.      .End
  1503.      The field in the Report header is input.type.  The fields in
  1504.      the list items are Aircraft.knownas and Aircraft.base.
  1505.      The field in the page footer is Page number.
  1506.      Suppose now that we print out the report and find that we had
  1507.      entered all the "Aircraft" "Knownas" fields in Upper case and
  1508.      all the "Base" fields in Lower case.  This would make the
  1509.      report quite untidy.  There is no need however to change the
  1510.      original data. To print both fields in Upper case all we need
  1511.      to do is alter each of the "Base" field contents using the
  1512.      "Upper" Function before printing it.
  1513.      To do this insert the line:-
  1514.                                  - 34 -
  1515. ................................................................................
  1516.         aircraft.base = upper(aircraft.base)
  1517.      immediately before the print list items command.
  1518.      As well as simply "Listing" data you can manipulate it in many
  1519.      different ways.  You can do any form of arithmetic on numeric
  1520.      fields and you can alter text, date and time fields with over
  1521.      fifty different functions.
  1522.      A function is a small internal routine which returns a value
  1523.      derived from one or more other values (Parameters) which you
  1524.      supply.  For Example, in the code line:-
  1525.      date = datetext(invoice.date)
  1526.      "Datetext" is a function to which you are passing the parameter
  1527.      "Invoice.date".  If invoice.date is 02/02/94 then the function
  1528.      "Datetext" will derive the text "2nd February 1994" and
  1529.      "Return" this as if it were a variable. The output field "Date"
  1530.      will therefore become "2nd February 1994".
  1531.      A functions parameters are always passed to it enclosed in
  1532.      brackets.  If there are more than one then they are separated
  1533.      by commas.
  1534.      The next section of the Manual introduces you to Procedures
  1535.      which perform transactions.  You should now read the
  1536.      descriptions of the following commands in the Programmers
  1537.      Reference.
  1538.      Copy All From
  1539.      Delete Record
  1540.      Clear Records From
  1541.      Update Record
  1542.      Pause On/Off
  1543.      Escape On/Off
  1544.      Together with the field control "Beep".
  1545.      Note:
  1546.      From Version 7 Procedures with input screens can be innitiated
  1547.      with any of the function keys 2,4,5,,7,8,9 or 10
  1548.      See Programmers Ref. Procedure command "Run"
  1549.                                  - 35 -
  1550. ................................................................................
  1551.                      PROCEDURES (TRANSACTIONAL)
  1552.      In Data Entry you make a "Transaction" when you add, update or
  1553.      delete a record.  You can make the same transactions in
  1554.      procedures.  There are, however, two major advantages to
  1555.      making your transactions via procedures.
  1556.      1.   You control which transactions can and cannot be made.
  1557.      2.   You can make any number of different transactions in any
  1558.           number of different forms.
  1559.      Consider the "Customers" form.  You would want any of your
  1560.      staff to be able to add a new customer in your absence. If you
  1561.      allow them to do this in Record Entry then they could also
  1562.      (deliberately or inadvertently) alter or delete other customers
  1563.      records.
  1564.      To prevent this, create a new procedure.  Create an input
  1565.      screen.  When you are asked if you wish to copy an existing
  1566.      form - reply "Yes" and select the customers form.  Save the
  1567.      input screen and select Create Procedure Code. Now enter the
  1568.      procedure code:-
  1569.      for customers new record
  1570.         copy all from input
  1571.      next
  1572.      Save the procedure - Let's call it "Enter customers".  You can
  1573.      now call this procedure from your "User Menus" described in the
  1574.      next section and your staff will be able to enter new customers
  1575.      without the opportunity to make any other transactions.
  1576.      You can also control parts of a transaction.  If your
  1577.      "Customers" form had a field for "Creditlimit" then, in the
  1578.      form, you would wish to be able to enter any credit limit you
  1579.      wanted, but you might wish to restrict the amount your staff
  1580.      could enter for a new customer.
  1581.      To do this you simply edit the field attributes for the
  1582.      "Creditlimit" field in the input screen.
  1583.      To set a fixed credit limit of say 
  1584. 500.00 set the user entry
  1585.      attribute to "No", the derived attribute to "Yes" and enter the
  1586.      derivation formula:- 500.
  1587.      To restrict the entry to a maximum of say 
  1588. 1000.00 you would
  1589.      leave the user entry attribute set to "yes" but derive the
  1590.      field:-  If(creditlimit > 1000,blank[beepMaximum credit 
  1591.               for new customers],creditlimit)
  1592.      There might also be fields on the "Customers" form which are
  1593.                                  - 36 -
  1594. ................................................................................
  1595.      irrelevant to the transaction of adding a new customer.  You
  1596.      might also have fields for personal comments which you do not
  1597.      wish your staff to see.  You can simply delete these from the
  1598.      input screen or change them to invisible.
  1599.      In other words you can limit a transaction in any way you wish
  1600.      and the final input screen can be totally different to the
  1601.      original form.
  1602.      Transaction procedures which delete or update records are
  1603.      created in a similar manner but are slightly more complicated.
  1604.      To create a procedure which allows your staff to delete
  1605.      customers, you would again copy the customers form as the input
  1606.      screen.  This time, the only field to which you allow User
  1607.      Entry is the "acountno" field.  You enter a relationship
  1608.      between this report and the "Customers" form linking "acountno"
  1609.      and derive all the other fields you wish to show as:-
  1610.      lookup(customers,name)
  1611.      lookup(customers,address)
  1612.      Etc.
  1613.      Your staff now enter the account number to be deleted. The
  1614.      other "looked up" fields are only there so that the name and
  1615.      address will appear confirming that the correct account number
  1616.      has been entered.
  1617.      The procedures code to delete the record is:-
  1618.      for customers with acountno = input.acountno
  1619.         delete record
  1620.      next
  1621.      As with the procedure to add a record you are still in complete
  1622.      control of what can or cannot be done.  Suppose that you had a
  1623.      field on the "customers" form which you kept updated with his
  1624.      account balance.  You would not want anyone to delete a
  1625.      customer who still had an outstanding balance on his account.
  1626.      To prevent this, just change the derivation for the "balance"
  1627.      field to :-
  1628.      if(lookup(customers,balance) <> 0,blank[beepCustomers cannot be
  1629.      deleted until their A/C is clear],0)
  1630.      You would also set the Mandatory attribute to "Yes" to prevent
  1631.      anyone from ignoring the warning.
  1632.      If you wanted a procedure which allowed staff to change a
  1633.      customers address but no other fields, then you would create
  1634.      the same input screen as for the delete record and the same
  1635.                                  - 37 -
  1636. ................................................................................
  1637.      relationship but this time you would allow user entry to the
  1638.      address field and derive it:-
  1639.      Default(lookup(customers,address))
  1640.      When the operator enters the account number for the customer
  1641.      whose address he wishes to change, the old address will appear
  1642.      to confirm that he has the right customer, but he will be able
  1643.      to edit it.
  1644.      The procedure code would be:-
  1645.      for customers with acountno = input.accountno
  1646.         customers.address = input.address
  1647.         update record
  1648.      next
  1649.      The second advantage of making transactions via procedures is
  1650.      that you can perform several tasks at once. Consider a Video
  1651.      Library hiring films to its members. There will be a form for
  1652.      the films, one for the members and one for daily takings.
  1653.      The procedure used for hiring out the films will have an input
  1654.      screen with a field for the members number, possibly three
  1655.      fields for the film numbers being hired, three more fields in
  1656.      which the films rental prices are looked up and one in which
  1657.      these three fields are totalled.  When the operator runs the
  1658.      procedure all the necessary transactions are performed by the
  1659.      procedure code:-
  1660.      for members with number = input.member
  1661.         if input.film1 <> blank then members.film1 = input.film1
  1662.         if input.film2 <> blank then members.film2 = input.film2
  1663.         if input.film3 <> blank then members.film3 = input.film3
  1664.         update record
  1665.      next
  1666.      if input.film1 <> blank then
  1667.         for films with number = input.film1
  1668.            films.hiredto = input.member
  1669.            films.datehired = system date
  1670.            update record
  1671.         next
  1672.      end if
  1673.      for daily takings
  1674.         total = total + input.total
  1675.         update record
  1676.      next
  1677.      The mid section of the code updating film1's record would of
  1678.      course be repeated for film2 and film3 but has been omitted for
  1679.      clarity.
  1680.                                  - 38 -
  1681. ................................................................................
  1682.                             USER MENUS
  1683.      Once you have created forms and procedures you can create an
  1684.      end user menu system to run them.  You could wait till all your
  1685.      procedures are finished but you will get a much better feel for
  1686.      how your program is developing if you start and use a menu
  1687.      system as you go.  Easy Base includes a User Menu call to its
  1688.      system menus so you can work from your own developing menu
  1689.      system while you are still developing your program.
  1690.      Select "Menus" from the main menu and have a look at the
  1691.      screen.  The Menus screen is an internal form just like the
  1692.      ones you have created. You have all the same facilities to
  1693.      enter, update and delete menus that you have in Data Entry to
  1694.      one of your own forms.
  1695.      Let's create a menu based on some of the forms and procedures
  1696.      previously discussed.
  1697.      The first field on the menus form is "Menu Name".  This is the
  1698.      unique field and a name must be supplied.  We'll call it
  1699.      "Customers".  The next field is "Menu Type". This is a choice
  1700.      field with two options, "Normal" and "Batch Execute".  The
  1701.      "Batch Execute" option will be discussed later.  For now,
  1702.      select "Normal".
  1703.      The third field is "Menu Title". Whatever you enter here will
  1704.      be displayed as a title (or heading) above your menu.
  1705.      The fourth field which is untitled on the screen is a choice
  1706.      field with the options, "Run on Number Key" and "Run on Return
  1707.      Key".  If you choose the first option then the items on your
  1708.      menu will be run as soon as the item number is pressed and if
  1709.      you choose the second option then typing the item number will
  1710.      move the highlight bar to the selection but the item will not
  1711.      be called until the return key is pressed.  In either case you
  1712.      will still be able to select items with the cursor control keys
  1713.      The next field asks for a "Sign on password" if a startup menu.
  1714.      You can start your application (program) on any menu that has
  1715.      a sign on password by restarting Easy Base and using that
  1716.      password instead of your developers password.  In this case we
  1717.      are going to menu the reports which add, delete and alter a
  1718.      customers address. This will be a sub menu so we leave this
  1719.      field blank.
  1720.      The main section of the "Menus" form has three columns of nine
  1721.      fields.  The first column is for the text to be displayed on
  1722.      the menu.  The second is for the type of action (function)
  1723.      which is to be called.  The third is for the individual item.
  1724.                                  - 39 -
  1725. ................................................................................
  1726.      With the cursor in the first text field we type:-
  1727.      Enter a New Customer      and press return.
  1728.      As soon as the cursor moves to the first "Function" field a
  1729.      menu appears listing all the different functions that can be
  1730.      called.  The first four choices allow you to:-
  1731.      1.   Run one of your procedures.
  1732.      2.   Recall the last output from one of your procedures.
  1733.      3.   Call the data entry screen for one of your forms.
  1734.      4.   Call another of your menus.
  1735.      The other functions are selected utilities from the system
  1736.      utilities menu which you may wish to provide to the
  1737.      end user without allowing him access to the entire system.
  1738.      Select "Run Procedure" and press return.
  1739.      When the cursor moves to the "Item" column Easy Base will list
  1740.      all your procedures. Choose "Enter customers".
  1741.      on the next two lines enter:-
  1742.      Delete Existing Customer   Run Procedure    Delete Customers
  1743.      Change Customers Address   Run Procedure    Address Change
  1744.      and press F2 to save the menu.
  1745.      Now let's make a start to the main "Startup" menu.  We may not
  1746.      have any procedures to put on it yet but we can get started
  1747.      with an item to call data entry to "Customers" and one to call
  1748.      the "Customers" sub menu.
  1749.      Fill in a new menus record using the name "Main Menu", Type
  1750.      "Normal" and Title "- M A I N   M E N U -".  This time enter a
  1751.      startup password, say "Fred".  Complete the Items section
  1752.      with:-
  1753.      Customers Records          Data Entry       Customers
  1754.      Customer Updates           User Menu        Customers
  1755.      Program Development        System menus
  1756.      Press F2 to save this menu then press escape all the way out to
  1757.      the DOS prompt (or your hard disk menu system).  Restart Easy
  1758.      Base.  This time, when the sign on screen appears, enter "Fred"
  1759.      and press return.
  1760.      Instead of the system menus, you will see your "Main Menu".
  1761.      If you select item 1 the "Customers" form will come up. If you
  1762.      select item 2 your sub menu will be overlaid and you can run
  1763.      any of the three procedures on it.  If you select item 3 you
  1764.                                  - 40 -
  1765. ................................................................................
  1766.      will be transferred to the Easy Base System menus where you can
  1767.      continue with the development of your program.
  1768.      Whenever you create new procedures or forms you can add them to
  1769.      your menu system.
  1770.      Suppose you would like the utilities, Backup Data, Restore Data
  1771.      and Install Printer to be available from your menu system.
  1772.      Create a new menu, let's call it "Utilities" with the items:-
  1773.      Backup data to disk        Backup Data
  1774.      Restore data from disk     Restore Data
  1775.      Install Printer            Install Printer
  1776.      Save this new menu then edit your main menu to include the new
  1777.      item:-
  1778.      Utilities                  User menu           Utilities
  1779.      When you have called the Easy Base system menus from one of
  1780.      your own menus then pressing escape does not exit the program,
  1781.      it returns you to your own menu.  You close down by pressing
  1782.      escape from your main menu.  When you get back to your "Main
  1783.      Menu" you will notice that the new "Utilities" item is not
  1784.      there. New Menu items cannot be added while the program is
  1785.      running. To incorporate the "Utilities" item you must again
  1786.      exit the program and restart with the password "Fred".
  1787.      As your program develops you can create as many menus as you
  1788.      need. Your "Main Menu" can call up to nine sub menus. Each of
  1789.      those can call another nine sub sub menus Etc Etc. You can also
  1790.      have additional startup menus with different passwords. These
  1791.      can either run completely different menus or can restrict
  1792.      different parts of the menu system to different users.
  1793.      When you start up on one of your menus systems Easy Base
  1794.      creates a default "Tree" structure for it.  From whichever menu
  1795.      is on screen the escape key backsteps down the tree until you
  1796.      reach your "Main Menu" and then exits the program.
  1797.      If one of the "forward" menu calls crosses branches, ie it
  1798.      calls a menu which is also called from a lower level then
  1799.      subsequent presses of the escape key backstep down the current
  1800.      branch and not back "cross tree".
  1801.      You can also make menu calls from low to high levels. (a sub-
  1802.      sub- sub menu can have an item which calls the main menu).
  1803.      In some circumstances you may prefer a hierarchical rather than
  1804.      a tree structure where the main menu is recalled after each
  1805.      individual procedure.  To accomplish this, each final item is
  1806.      placed on its own menu followed by a call to the main menu and
  1807.                                  - 41 -
  1808. ................................................................................
  1809.      the menu type is changed to "Batch Execute".
  1810.      When you create a "Batch Execute" menu then instead of
  1811.      displaying a menu for you to choose from, Easy Base
  1812.      executes each item on the menu in sequence and then returns to
  1813.      the menu which called it.
  1814.      With batch execute menus you can automate many of the processes
  1815.      in your application.  If you have several printouts to be done
  1816.      each day you can have them all done from batch execute menus.
  1817.      Similarly, if you need to update many reporting procedures for
  1818.      later "Recall" to the screen, these can all be done at once.
  1819.      There is no limit to the number of procedures which can be
  1820.      batched - One batch menu can call another.
  1821.      If you create a "Startup" batch menu then, provided it does not
  1822.      call a "Normal" menu, Easy Base will perform all the tasks on
  1823.      the menu and then exit to DOS.
  1824.      If you create a "Startup" batch menu which eventually calls a
  1825.      "Normal" menu then the batch process stops at that point and
  1826.      the "Normal" menu becomes the main (root) menu.  Pressing
  1827.      escape from this menu exits to DOS. it never returns to the
  1828.      startup batch menu which called it
  1829.      Start up batch menus are useful for running regular daily
  1830.      procedures and for forcing the user to check the system date
  1831.      and time.
  1832.      There are many other uses for batch execute menus.  You can
  1833.      automate menu changes. If, for example, running one particular
  1834.      procedure is invariably followed by  running one from a choice
  1835.      of three others then the menu containing the others can be
  1836.      batched after the first procedure.
  1837.      In Easy Base you can create quite long and complex procedures
  1838.      but they are eventually limited by memory constraints.  If you
  1839.      ever run out of memory creating a long procedure then just
  1840.      split it and batch the parts.
  1841.      Don't forget to set the output of non print reports to "Disk"
  1842.      otherwise Browse Mode will be invoked.
  1843.                                  - 42 -
  1844. ................................................................................
  1845.                       EXTERNAL FILE ACCESS
  1846.      In order to provide flexible import and export to data files
  1847.      external to your applications, Easy Base includes a complete
  1848.      set of low level file access commands. :- Open, Close, Seek
  1849.      Read, Write, Find, Shell and Erase.
  1850.      Full details of the commands and how to use them are given in
  1851.      the programmers reference but please read the following notes.
  1852.      You can only open one external file at a time but you can
  1853.      transfer data either way between it and any number of Easy Base
  1854.      files.
  1855.      You can open any number of external files within one procedure
  1856.      but you must close each before you open the next.
  1857.      In Easy Base all data is converted to a common type for
  1858.      processing. Within the system this has the advantage that you
  1859.      never need to worry about what type of data you are handling.
  1860.      You can assign a text field's value to a numeric field and you
  1861.      can assign the result of a calculation to a text field.
  1862.      However, in order to do this Easy Base pre processes text
  1863.      variables. If you are accustomed to file access, string
  1864.      manipulation and trimming functions then you may get unexpected
  1865.      results.
  1866.      Here are the rules:
  1867.      If you read a string to an Easy Base text field all leading and
  1868.      trailing spaces are removed. If the remaining string is longer
  1869.      than the declared field length then it is truncated to the
  1870.      field length.
  1871.      If you read a string to an Easy Base text variable then all
  1872.      trailing spaces are removed. Text Variables are variable
  1873.      length.
  1874.      If you wish to create a string with leading spaces for a write
  1875.      command then you must do it in a text variable. Text fields do
  1876.      not accept leading spaces. You can pad strings with spaces
  1877.      using the Spacepad and Jointext(stringof()) functions.
  1878.      If you read an ASCII line then it is read without the Cr/Lf
  1879.      sequence.
  1880.      You can read ASCII directly into numeric fields.
  1881.      The data in an Easy Base Text Block field is formatted with a
  1882.      single Chr$(13) wherever a new line is to be forced.
  1883.      To read ASCII to a Text Block field, read lines to a variable
  1884.                                  - 43 -
  1885. ................................................................................
  1886.      then join the variable to the field with an intervening
  1887.      CHr$(13).
  1888.      Ex.
  1889.      read line to LineVar
  1890.      Pupils.notes = Jointext(pupils.notes,Chr$(13),Linevar)
  1891.      To Write a Text Block field as ASCII lines use the keyword
  1892.      Line_Len in the write command.
  1893.      Ex.
  1894.      write Pupils.Notes Line_len 60
  1895.      You cannot write quotation marks within quoted text. Whenever
  1896.      Easy Base processes a text field, variable or read in string it
  1897.      substitutes Chr$(127) for internal quotation marks and replaces
  1898.      them after the process. This substitution is not done for
  1899.      direct assignments. TextVar = "Fred said "Hello"" is not
  1900.      allowed. If you need to make such an assignment then you must
  1901.      replace the internal quotation marks with Chr$(127) yourself.
  1902.      To create CHR$(127) in the procedure editor, hold down the ALT
  1903.      key and type 127 on the numeric keypad.
  1904.                                  - 44 -
  1905. ................................................................................
  1906.                     EASY BASE DATA FILE FORMAT
  1907.      Easy Base data files are fixed length record files with no
  1908.      field separator. There is no file header.
  1909.      There is a three byte record header. Byte one is "L" for a live
  1910.      record and "D" for a record marked for deletion. Bytes 2 and 3
  1911.      are null.
  1912.      The field order is top left to bottom right from the default
  1913.      input screen.
  1914.      All text fields are ASCII.
  1915.      All numeric, date and time fields are Microsoft 8 Byte double
  1916.      precision numbers.
  1917.      In the case of dates, this represents the number of days from
  1918.      the first of January 1981 and in the case of time, the number
  1919.      of seconds from midnight.
  1920.                                  - 45 -
  1921. ................................................................................
  1922.                          SYSTEM REQUIREMENTS
  1923.      Required.
  1924.          IBM or compatible 286 or higher
  1925.          1Meg Ram
  1926.          540k free conventional memory   (570k in Network Version)
  1927.      Preferred.
  1928.         4 Meg expanded memory with 2 Meg allocated to PC-Cache
  1929.      NOTE:-
  1930.         If you have 2 Meg of expanded memory then certain EMS
  1931.      managers can cause Easy Base not to load with the error message
  1932.      "Insufficient EMS to load overlays". If this happens to you
  1933.      then you can load Easy Base in conventional memory by remming
  1934.      out the EMS driver in your Config.Sys file.
  1935.                          SYSTEM LIMITATIONS
  1936.      Fields per Form         500
  1937.      Indexes per Form        500
  1938.      Record Length           Limited by display of 4 screen pages
  1939.      Records per Form        Limited by Maximum data or index file
  1940.                              length of 2,100 Megabytes
  1941.      Forms per application       }     Total of 500 in
  1942.      Procedures per application  }     any combination.
  1943.      Menus per application             500
  1944.                                  - 46 -
  1945. ................................................................................
  1946.                        DOS FILENAME CONVENTIONS
  1947.      The Easy Base system files are:-
  1948.         EB.EXE     The program file     (EB.OVL Network)
  1949.         EB.CUR     Initial screen setup
  1950.         EB.SET     Configuration file   (EB.C0, EB.C1 Etc. Network)
  1951.         EB.MEN     User Menus form
  1952.         EB.REL     Relationships form
  1953.         EB.MSG     Text and error messages
  1954.         EB.PRS     Printer drivers
  1955.         EB.D01     Main dictionary
  1956.         EB.DO2     Personal dictionary
  1957.      The files which are created in the data directories have the
  1958.      following filename convention:-
  1959.      Forms:-
  1960.         BASE(No).DEF      The entry screen definition.
  1961.         BASE(No).DAT      The data file.
  1962.         BASE(No).(No)     Index files.
  1963.      Choice field lists
  1964.         LIST(No).DAT
  1965.      Procedures
  1966.         PROC(No).PRO      The procedure code.
  1967.         PROC(No).DEF      The input screen.
  1968.         PROC(No).REP      Procedure output (Pre Network Versions)
  1969.         PROC(No).R(No)    Procedure output (Network versions)
  1970.      There are also six individual files:-
  1971.         MENUS.DAT         The menus you create.
  1972.         RELATION.DAT      The relationships you create.
  1973.         CHOICES.DIR       The choice list directory.
  1974.         BASE.DIR          The forms directory.
  1975.         PROC.DIR          The procedures directory.
  1976.         RECOVER.INF       Recovery information to reinstate a form
  1977.                           should you suffer a power failure during
  1978.                           a pack or reformat operation.
  1979.      From V9 each form and procedure input screen also has a pre
  1980.      processed file: BASE(NO).PPR - PROC(NO).PPR.
  1981.      From Network V1 Private data and index files take the main file
  1982.      name overstamped from the second character by the terminal
  1983.      number. The file name for Terminal 12's private data for
  1984.      BASE6.DAT  is B12E6.DAT
  1985.                                  - 47 -
  1986. ................................................................................
  1987.      Easy Base is a registered trade mark of John Turnbull.
  1988.      Easy Base documentation is copyright John Turnbull 1994. It may
  1989.      be freely distributed as part of the Shareware program and
  1990.      users of Easy Base may print a single copy of the documentation
  1991.      for their own use. All other rights are reserved.
  1992.      Trade marks of any other company included in the documentation
  1993.      are acknowledged.
  1994.      John Turnbull disclaims all warranties as to this software,
  1995.      whether express or implied, including without limitation any
  1996.      implied warranties of merchantability, fitness for a particular
  1997.      purpose, functionality, data integrity or protection.
  1998.                                  - 48 -
  1999. ................................................................................
  2000.       
  2001.                      SELECTED PROGRAMMING TOPICS
  2002.       
  2003.                   Address Labels                50
  2004.                   Automatic Lookups             52
  2005.                   Batch Starting                53
  2006.                   Check Off Fields              54
  2007.                   Compound Index                55
  2008.                   Compound Lookups              58
  2009.                   Conditional Lookups           59
  2010.                   Correcting Stats.             60
  2011.                   Creating Runtime              61
  2012.                   Customize Help Line           62
  2013.                   Cyclic Procedures             63
  2014.                   Data Type Conversion          64
  2015.                   Duplicate Prevention          65
  2016.                   Form Letters                  66
  2017.                   Global Defaults               68
  2018.                   Input Screen Format           69
  2019.                   Invoicing/Ordering            70
  2020.                   Keyword/Text Search           73
  2021.                   Linking Applications          75
  2022.                   Maximizing Speed              76
  2023.                   Multiple Columns              78
  2024.                   Printing System Val.          79
  2025.                   Q And A Input Screen          80
  2026.                   Runtime Auto Start            81
  2027.                   Set System Values             82
  2028.                   Tabulation                    83
  2029.                   Totals & Sub Totals           84
  2030.                                 - 49 -
  2031. ................................................................................
  2032.       ADDRESS LABELS                              
  2033. ADDRESS LABELS
  2034.       The following procedure prints two columns of address labels
  2035.       from a "Addr" form.
  2036.       .......................Procedure code................
  2037.       Declare output fields
  2038.          Addr.name : Addr.street : Addr.town : Addr.pcode
  2039.          Lname : Lstreet : Ltown : Lpcode
  2040.       end
  2041.       for Addr
  2042.          if Lname = blank then
  2043.             Lname = Addr.name : Lstreet = Addrstreet
  2044.             Ltown = Addr.town : Lpcode = Addrpcode
  2045.          else
  2046.             print list items
  2047.             Lname = blank : Lstreet = blank
  2048.             Ltown = Blank : Lpcode  = blank
  2049.          end if
  2050.       next
  2051.       if Lname <> blank then print list items
  2052.       ....................Output Format........................
  2053.       .List Items
  2054.            {Lname field        }       {Addr.name field    }
  2055.            {Lstreet field      }       {Addr.street field  }
  2056.            {Ltown field        }       {Addr.town field    }
  2057.            {Lpcode field       }       {Addr.pcode field   }
  2058.       .end
  2059.       The field positioning and the distance between the .List Items
  2060.       and .end can be adjusted to fit the label paper.
  2061.       If your label paper has three columns then you could use the
  2062.       following procedure.
  2063.       declare output fields
  2064.          Addr.name : Addr.street : Addr.town : Addr.pcode
  2065.          Mname : Mstreet : Mtown : Mpcode
  2066.          Lname : Lstreet : Ltown : Lpcode
  2067.       end
  2068.       declare variables
  2069.          x as number
  2070.       end
  2071.       Continued.
  2072.                                 - 50 -
  2073. ................................................................................
  2074.       ADDRESS LABELS                              
  2075. ADDRESS LABELS
  2076.       for addr
  2077.          x = x + 1
  2078.          if Mod(x,3) = 1 then
  2079.             Lname = Addr.name : Lstreet = Addr.street
  2080.             Ltown = Addr.town : Lpcode = Addr.pcode
  2081.          end if
  2082.          if Mod(x,3) = 2 then
  2083.             Mname = Addr.name : Mstreet = Addr.street
  2084.             Mtown = Addr.town : Mpcode = Addr.pcode
  2085.          end if
  2086.          if Mod(x,3) = 0 then
  2087.             Print list items
  2088.             Lname = Blank : Lstreet = blank
  2089.             Ltown = blank : Lpcode = Blank
  2090.             Mname = Blank : Mstreet = blank
  2091.             Mtown = blank : Mpcode = Blank
  2092.          end if
  2093.       next
  2094.       If Lname <> blank then print list items
  2095.       .........................output format...................
  2096.       .list items
  2097.          { Lname       }    { Mname       }   { Addr.name   }
  2098.          { Lstreet     }    { Mstreet     }   { Addr.street }
  2099.          { Ltown       }    { Mtown       }   { Addr.town   }
  2100.          { Lpcode      }    { Mpcode      }   { Addr.pcode  }
  2101.       .end
  2102.       See Also:- Form Letters
  2103.                                 - 51 -
  2104. ................................................................................
  2105.       Automatic Lookups                           
  2106. Automatic Lookups
  2107.       Normally, when a user initiates a primary lookup in a text
  2108.       field he will enter a few characters followed by the * in order
  2109.       to narrow down his choice list. If, however, the possible list
  2110.       is fairly small you may wish to have it displayed automatically
  2111.       as if it was the list for a choice field.
  2112.       For example, you have a departments form with a field "name"
  2113.       and there are only twelve records.
  2114.       When entering records to your "Employees" form which has a
  2115.       field for his department, you wish to lookup the department
  2116.       name. If you derive the Department field on this form as
  2117.       "Lookup (Departments,name) and allow user access to it then the
  2118.       user must type at least an * and press return to bring up the
  2119.       list of department names.
  2120.       You can make this list pop up automatically by setting user
  2121.       entry to the department field to "no" and deriving it with the
  2122.       formula:
  2123.       If(Department = Blank,"*",Lookup(Departments,Name))
  2124.       In other words the derivation formula automates the typing of
  2125.       the *.
  2126.       Please note that all forms and input screens must have at least
  2127.       one field to which the user has access. If you wish to make an
  2128.       automatic lookup on a procedure input screen that only has one
  2129.       field then you must add a second field purely to hold the
  2130.       cursor. This can of course be invisible.
  2131.                                 - 52 -
  2132. ................................................................................
  2133.       BATCH STARTING                              
  2134. BATCH STARTING
  2135.       You can by pass any or all of the sign on parameters either by
  2136.       setting them in the environment or by supplying them on the
  2137.       command line.
  2138.       To log on as terminal one in the sub directory accounts using
  2139.       the password "Fred", add the following lines to your
  2140.       autoexec.bat file:-
  2141.       SET EBT=1
  2142.       SET EBD=ACCOUNTS
  2143.       SET EBP=FRED
  2144.       Or start Easy Base with the command line :-
  2145.       EB T=1 D=ACCOUNTS P=FRED
  2146.       The terminal number parameter applies to network versions only.
  2147.       Any parameters which are not supplied either in the environment
  2148.       or on the command line will be asked for on start up.
  2149.       If you have set the start up parameters in the environment and
  2150.       you start Easy Base with different parameters on the command
  2151.       line, The parameters on the command line override those in the
  2152.       environment.
  2153.       If your application has different passwords for different menu
  2154.       structures you can set the terminal number and directory and
  2155.       leave the user to supply the password.
  2156.       If the user has access to different directories then just set
  2157.       the terminal number and the user can choose the directory and
  2158.       enter the password.
  2159.       See also Runtime Autostart
  2160.                                 - 53 -
  2161. ................................................................................
  2162.       Check off fields                            
  2163. Check off fields
  2164.       Occasionally you may wish to have a field which is simply used
  2165.       to mark or "Check off" items to be done or printed. There is no
  2166.       graphical output from Easy Base but you can create a reasonable
  2167.       check off field by making it a choice field and using the two
  2168.       choices ASCII 255 and ASCII 251.
  2169.       You must use ASCII 255 as the blank as a "Blank" choice is
  2170.       deleted at run time and ASCII 251 (
  2171. ) which is actually the
  2172.       square root sign makes a reasonable "Tick".
  2173.       To enter the characters, hold down the Alt key and type the
  2174.       number on the numeric key pad.
  2175.       To have a form or input screen display with the items ready
  2176.       ticked, just define the tick fields with this choice list,
  2177.       derive them as Default(
  2178. ) and make the color Text, Alt1 or
  2179.       Alt2. Easy Base will automatically display the help line "Press
  2180.       the space bar to change".
  2181.                                 - 54 -
  2182. ................................................................................
  2183.       COMPOUND INDEX                              
  2184. COMPOUND INDEX
  2185.       If you need to list records from a form in such a way that they
  2186.       are grouped by one field but with each record in the group
  2187.       ordered by another then you can either use a compound index
  2188.       field or "Subindex" the group during the procedure.
  2189.       A compound index field is simply an additional field in which
  2190.       the contents of two or more fields are compounded using the
  2191.       "Jointext" function. The field is indexed and the index on that
  2192.       field can then be used to select records with the desired group
  2193.       ordering.
  2194.       For example:- A "Videos" form has fields for "Title",
  2195.       "RentalPrice" and "Category".
  2196.       To list the records grouped by "Category" but with the "Titles"
  2197.       in each category in alphabetic order you add another field to
  2198.       the form which is Text, Indexed and long enough to hold the
  2199.       contents of both the "category" and "Title" fields. The field
  2200.       is derived by joining the text of the "Category" and "Title"
  2201.       fields.
  2202.       There are a couple of minor complications in creating compound
  2203.       index fields. Firstly the "Jointext" function by default strips
  2204.       any trailing space characters from the text it is joining. If a
  2205.       straight "Jointext" function was used and the first two videos
  2206.       entered were "A Bridge Too Far" and "Snow White" then the
  2207.       compound fields would derive as:-
  2208.       "WarA Bridge Too Far"  and
  2209.       "CartoonSnow White"
  2210.       When what you need is:-
  2211.       "War      A Bridge Too Far"  and
  2212.       "Cartoon  Snow White      "
  2213.       To produce the desired spacing in the compound field use the
  2214.       "Spacepad" function.
  2215.       If the length of the "Category" field is 15 then derive the
  2216.       compound field with - Jointext(spacepad(category,15),title)
  2217.       If you are compounding more than two fields then "spacepad" all
  2218.       the fields being joined to their own field's length except the
  2219.       last one.
  2220.       The maximum length of a text field in Easy Base is 80
  2221.       characters. If the fields you need to compound total more than
  2222.       80 then you must reduce the length of the field names. Compound
  2223.       indices in Text Block fields should not be used.
  2224.                                 - 55 -
  2225. ................................................................................
  2226.       COMPOUND INDEX                              
  2227. COMPOUND INDEX
  2228.       Once you have created a compound field and checked that it
  2229.       derives correctly it is normal to define it as invisible and no
  2230.       entry anyway as it is not its contents that are of interest but
  2231.       the order which its index produces.
  2232.       Ex.   Assuming the compound field was called "catgroup"
  2233.       ..........................code..................
  2234.       for videos with catgroup in order
  2235.          print list items
  2236.       next
  2237.       ........................format.................
  2238.       .List Items
  2239.             {Videos.Category Field}     {Videos.Title Field}
  2240.       .End
  2241.       Ex.
  2242.       ...........................code....................
  2243.       declare variables
  2244.          catcheck as text
  2245.       end
  2246.       for videos with catgroup in order
  2247.          if catcheck <> videos,category then print group header
  2248.          catcheck = videos.category
  2249.          print list items
  2250.       next
  2251.       ..........................format...............
  2252.       .Group Header
  2253.          -------------------------------------
  2254.          Films categorized as {category field}
  2255.          -------------------------------------
  2256.       .List Items
  2257.                     {Title field}
  2258.       .End
  2259.       There is yet a further complication if one or more of the
  2260.       fields to be compounded is numeric. Easy Base index files are
  2261.       sorted alphabetically if the field is text and numerically if
  2262.       the field is numeric. A compound field is always text so if you
  2263.       need to compound a numeric field you have to ensure that it
  2264.       will sort alphabetically to the same order that it sorts
  2265.       numerically. The text of numeric values sort alphabetically to
  2266.       the same order as their values only if they all have the same
  2267.       number of digits either side of the decimal point.
  2268.       6  12 and 34 sort alphabetically as 12  34  6
  2269.       but
  2270.       06 12 and 34 sort alphabetically as 06  12  34
  2271.                                 - 56 -
  2272. ................................................................................
  2273.       COMPOUND INDEX                              
  2274. COMPOUND INDEX
  2275.       Easy Base provides the function "Zeropad" to pad numbers to the
  2276.       same length for compounding.  The "Zeropad" function has three
  2277.       parameters - The number to be padded, the number of digits left
  2278.       of the decimal to pad to and the number of digits right of the
  2279.       decimal to pad to. All three parameters must be supplied. If
  2280.       the number is an integer then the third parameter is 0.
  2281.       Ex. To list the "Videos" records grouped by rental price with
  2282.       the titles in each price group in order you would create a
  2283.       compound field derived with:-
  2284.       Jointext(zeropad(rentalprice,2,2),title)
  2285.       Ex.
  2286.       A "Ships" form has fields for "Type" and "Displacement"
  2287.       To list the ships grouped by type with the Displacement in each
  2288.       group in order you would create a compound field derived with:-
  2289.       jointext(spacepad(type,15),zeropad(displacement,8,0))
  2290.       In many cases where you wish to compound a mixture of text and
  2291.       numeric fields you will require the numeric values to be listed
  2292.       in descending order while the text value is to be in alphabetic
  2293.       order.
  2294.       In the above example for ships, had you wished each group to
  2295.       be listed with "Displacement" in descending order you would
  2296.       derive the compound field as:-
  2297.       jointext(spacepad(type,15),reverse(zeropad(displacement,8,0)))
  2298.       The "Reverse" function simply inverts the ACSII number of each
  2299.       character in its parameter so that it will sort in reverse
  2300.       order in the index file.
  2301.       The "Reverse" function works equally well on text values
  2302.       although reverse alphabetic lists are seldom required.
  2303.       The "Zeropad" function will only pad out a number to the size
  2304.       required. It will not trim the number if it is already longer
  2305.       than one of the pad lengths. You should not therefore create
  2306.       compound fields with Floating Point numbers.
  2307.       If you compound a date or time field you should zeropad it to
  2308.       5,0 as the text which will be used is actually the date or time
  2309.       fields numeric value.
  2310.                                 - 57 -
  2311. ................................................................................
  2312.       COMPOUND LOOKUPS                            
  2313. COMPOUND LOOKUPS
  2314.       Occasionally, in an input screen, you will wish to lookup
  2315.       details from a form whose unique field is a compound of two
  2316.       others.  As an example, if you wished to lookup details from
  2317.       the "Userlist" form, mentioned in the manual, then you would
  2318.       have to base the lookups on a relationship between a field on
  2319.       the input screen and the "UNI" field in "Userlist". The "UNI"
  2320.       field in userlist is a combination of the "Aircraft" forms
  2321.       "Knownas" field and the "Airlines" form "Name" field.
  2322.       Although you could simply use a field "UNI" on the input screen
  2323.       and derive it :- Lookup(userlist,uni) - this would mean that
  2324.       the end user would have to enter the whole of the aircraft
  2325.       Knownas part plus part of the airlines name part plus the "*"
  2326.       in order to get the lookup.
  2327.       This would not only be awkward to use but would also entail
  2328.       explaining compound fields to the end user.
  2329.       You can avoid this situation by providing two fields, one in
  2330.       which the user looks up the aircraft knownas field and one in
  2331.       which he looks up the airline name. These are based on separate
  2332.       relationships between the input screen and the "Aircraft" and
  2333.       "Airlines" forms.
  2334.       The input screen's "UNI" field can now be made invisible with
  2335.       no user entry and derived:- Jointext(knownas,name).
  2336.       A relationship is entered between the input screen and the
  2337.       "Userlist" form linking the "UNI" fields and all the required
  2338.       details can then be derived :- lookup(userlist,whatever).
  2339.                                 - 58 -
  2340. ................................................................................
  2341.       Conditional Lookups                         
  2342. Conditional Lookups
  2343.       Occasionally you may wish to use a single field either to
  2344.       initiate a lookup or to accept direct input from the keyboard.
  2345.       For example on an input screen to a procedure that enters
  2346.       invoice lineitems there is a field Partname which is related to
  2347.       the Name field in the "Parts" form. The entry to this field
  2348.       initiates a primary lookup for its own value and a secondary
  2349.       for the Price field. The user enters the first few characters
  2350.       of the part name followed by an *, then chooses the part name
  2351.       from the lookup list. If you also wish the user to be able to
  2352.       enter a partname that is not in the parts form then derive the
  2353.       partname field:-
  2354.       If(Intext(Partname,"*") > 0,Lookup(Parts,Name),Partname)
  2355.       If the user enters an * anywhere in the field then a lookup
  2356.       will be done from the parts form, but if he does not enter an *
  2357.       then the field will retain whatever name he entered.
  2358.       If you wish to be able to tell whether or not a lookup has been
  2359.       made for use in the procedure code - perhaps to add the new
  2360.       part to the parts form - then use a special character other
  2361.       than the * as the condition.
  2362.       For example, if you derive Partname as:-
  2363.       If(Lefttext(Partname,1) = "+",Partname,Lookup(Parts,Name))
  2364.       then any entry to the field which starts with the "+" character
  2365.       will not initiate the lookup. You can then use the fact that
  2366.       the partname starts with a + to enter a new record in the parts
  2367.       form.
  2368.       Declare variables
  2369.          NN as text
  2370.       end
  2371.       NN = Input.partname
  2372.       If Lefttext(NN,1) = "+" then
  2373.          NN = righttext(NN,Lengthtext(NN)-1)
  2374.          For parts new record
  2375.             Parts.name = NN
  2376.          Next
  2377.       End if
  2378.       for Invoicelines
  2379.          copy all from input
  2380.          Partname = NN
  2381.       next
  2382.                                 - 59 -
  2383. ................................................................................
  2384.       CORRECTING STATS.                           
  2385. CORRECTING STATS.
  2386.       If you write an application in which records are entered via
  2387.       procedures and "running" statistics are kept, you will have to
  2388.       provide procedures which allow the user to correct any mistakes
  2389.       he has made.
  2390.       For Example: - In a "Time Sheets" application the user enters a
  2391.       time and customer on the input screen of a procedure. The
  2392.       procedure then calculates the charge, writes the charge and
  2393.       customers name to the "Timesheet" form, adds the charge to the
  2394.       "Balance" field in the "Customers" form and also adds it to the
  2395.       "Total" field in the "Workinhand" form.
  2396.       If the operator makes an error then correcting the entry in the
  2397.       "Timesheet" form is simply a case of updating it but to correct
  2398.       the "Balance" and "Total" fields you must add the corrected
  2399.       value and subtract the old incorrect value.
  2400.       To get the two values together for your procedure, create an
  2401.       input screen where the operator enters the "line" ("line" is
  2402.       the unique sequenced field in "Timesheet").  Then create two
  2403.       fields for the values. The first, "oldval" is derived
  2404.       lookup(timesheet,charge) and the second, "newval" is derived
  2405.       default(lookup(timesheet,charge).
  2406.       The "Oldval" field can be invisible and has no user entry.
  2407.       You would also add two similarly derived fields "Oldcustomer"
  2408.       and "Newcustomer".
  2409.       When the user edits the "Newval" and/or "Newcustomer" field and
  2410.       presses F2 , all the required values are available to the
  2411.       procedure code:-
  2412.       pause off : escape off
  2413.       for timesheet with line = input.line
  2414.          timesheet.charge = input.newval
  2415.          timesheet.customer = input.newcustomer
  2416.          update record
  2417.       next
  2418.       for customers with name = input.oldcustomer
  2419.          customers.balance = customers.balance - input.oldval
  2420.          update record
  2421.       next
  2422.       for customers with name = input.newcustomer
  2423.          customers.balance = customers.balance + input.newval
  2424.          update record
  2425.       next
  2426.       for workinhand
  2427.         workinhand.total = workinhand.total+input.newval-input.oldval
  2428.         update record
  2429.       next
  2430.                                 - 60 -
  2431. ................................................................................
  2432.       CREATING RUNTIME                            
  2433. CREATING RUNTIME
  2434.       To create a distributable application with the Easy Base
  2435.       Royalty free Runtime Module, first, ensure that your
  2436.       application has a user menu with a start up password. If you
  2437.       wish your runtime application to start without a sign on screen
  2438.       then this password should be "Autostart".
  2439.       Make a new directory for your module and copy all the files
  2440.       from the Easy Base sub directory in which you developed the
  2441.       application to it.
  2442.       Copy the Configuration file "EB.SET" from your Easy Base
  2443.       directory to this directory.
  2444.       Insert the Runtime Module disk in a floppy drive. Change to
  2445.       that drive and type "MODULE".
  2446.       The "Module" program will first ask you for the path to the
  2447.       application files. Once you enter this it will unpack the
  2448.       runtime files into your new directory.
  2449.       It will then ask for the name of your application. The name you
  2450.       supply here will be displayed on any sign on screens and also
  2451.       on the shutdown "Thank you for using - " line.
  2452.       It will then ask you for your copyright line. The text you
  2453.       enter here will replace the line "Application of Easy Base -
  2454.       Not for Resale" which appears above your menus.
  2455.       Finally, you will be asked for the Executable file name you
  2456.       wish to use for your program.
  2457.       When you have entered the details - Press F2 and your
  2458.       application will be complete and ready to sell.
  2459.                       --------------------------
  2460.       EASY INSTALL UTILITY
  2461.       For professional distribution disks just like the ones Easy
  2462.       Software is distributed on, you can purchase Easy Install.
  2463.       This utility will compress your application and create a
  2464.       distribution disk with an install program customized for your
  2465.       application.
  2466.                                 - 61 -
  2467. ................................................................................
  2468.       CUSTOMIZE HELP LINE                         
  2469. CUSTOMIZE HELP LINE
  2470.       You can replace the default help line (bottom line) in both
  2471.       data entry and procedure input screens.
  2472.       Press F6 in form or input screen design to access the help
  2473.       line.
  2474.       If you wish to revert to the default help line just erase your
  2475.       customized one.
  2476.       The line which you enter here becomes the default but is
  2477.       overridden when the cursor is in any field with a Help prefix.
  2478.                                 - 62 -
  2479. ................................................................................
  2480.       CYCLIC PROCEDURES                           
  2481. CYCLIC PROCEDURES
  2482.       In many applications you will come across the situation where
  2483.       you need a procedure which will perform the same actions on a
  2484.       given set of records. For example, in a payroll system the
  2485.       procedure which calculates the employees wage and deductions
  2486.       has to be repeated for each employee so that their hours can be
  2487.       entered. If you simply enter each employees Worksno and lookup
  2488.       his or her details then it will be easy to miss an employee or
  2489.       to do one twice.
  2490.       To avoid this you can create a procedure which will cycle each
  2491.       employee through the input screen and terminate when all
  2492.       employees have been processed.
  2493.       On the employees form, add a field "Cycled" which is a single
  2494.       character indexed field derived :- Default("N").
  2495.       On the procedure input screen add an invisible field "Cycled"
  2496.       which is derived "N"
  2497.       You now enter two relationships between the procedure and the
  2498.       employees form. The main relationship "Employees" links the
  2499.       fields "Worksno" and the second, lets call it "Cycled" links
  2500.       the "Cycled" fields.
  2501.       On the input screen you derive the "Worksno" field as
  2502.       Lookup(cycled,worksno) and all the other details as
  2503.       lookup(employees,Whatever).
  2504.       When you run the procedure, the first employees details will be
  2505.       loaded automatically and all you have to enter are his hours.
  2506.       To have the next employee loaded after you run the procedure,
  2507.       the procedure code simply includes the lines:-
  2508.       for employees with worksno = input.worksno
  2509.          employees.cycled = "Y"
  2510.          update record
  2511.       next
  2512.       When all employees have been processed the "Worksno" field will
  2513.       derive blank as there are no employees with "N" in the "Cycled"
  2514.       field. You can therefore pass a "finished" message by altering
  2515.       the derivation of "Worksno" to :-
  2516.         if(lookup(cycled,worksno)=blank,blank[beepAll Employees have
  2517.         now been processed],lookup(cycled,worksno))
  2518.       To reset cycling for the next payroll you write an additional
  2519.       procedure with the code:-
  2520.       for employees
  2521.          employees.cycled = "N" : update record
  2522.       next
  2523.                                 - 63 -
  2524. ................................................................................
  2525.       Data Type Conversion                        Data Type Conversion
  2526.       In Easy Base, modifying the structure of a data file after it
  2527.       contains data is very easy and flexible. If you select Modify
  2528.       Existing Form from the Forms menu you can add fields, delete
  2529.       fields, change field order, change field lengths and Easy Base
  2530.       will reformat your existing data automatically.
  2531.       You can NOT however change data types simply by changing the
  2532.       field type. If you change a field type and save the form you
  2533.       will almost certainly lose the data that was in that field.
  2534.       (Other than changing from one numeric type to another)
  2535.       If you work entirely within Easy Base there is no reason why
  2536.       you should ever need to change a field type. However, if you
  2537.       have imported data from Dbase or Fixed Length ASCII you may
  2538.       find yourself with numeric or date values held in text fields.
  2539.       The procedure for converting data from one type to another is
  2540.       as follows:-
  2541.       1.   Select Modify Existing Form
  2542.       2.   Add a new field of the desired type with a derivation
  2543.            formula such that it will derive its value from the field
  2544.            of the old type.
  2545.       3.   Save the form.
  2546.       4.   Select Modify the form again.
  2547.       5.   Cancel the derivation formula in the new field and delete
  2548.            the old field.
  2549.       6.   Re save the form.
  2550.       To derive a numeric field from a text field the derivation
  2551.       formula is simply the text field name.
  2552.       To derive a date field from a Dbase imported date in a text
  2553.       field called DT the formula is:-
  2554.       Makedate(midtext(DT,5,2),midtext(DT,7,2),midtext(DT,3,2))
  2555.       Version 3.10
  2556.       From V3.1 you can change field types between text and numeric
  2557.       and retain any numeric values that were in the field
  2558.       automatically . You still cannot change a field type from date
  2559.       or time to text or vice versa without following the above
  2560.       procedure.
  2561.                                 - 64 -
  2562. ................................................................................
  2563.       DUPLICATE PREVENTION                        DUPLICATE PREVENTION
  2564.       1.  Where "Blank" values are acceptable.
  2565.       Quite often you will come across a situation where a field must
  2566.       not have duplicate entries but can still be left blank. You
  2567.       cannot define this field as unique because that would prevent
  2568.       more than one blank entry.  A good example of such a situation
  2569.       is in the "Menus Form" of Easy Base. The definition and unique
  2570.       field is the "Menu Title" but no two records may have the same
  2571.       entry in the sign on "Password" field.
  2572.       To prevent duplicate entries other than blanks you must enter a
  2573.       relationship between the form and itself with the field to be
  2574.       tested as the related field in both primary and secondary
  2575.       forms.
  2576.       The field is then derived as :-
  2577.       If(lookup(menus,password) <> blank,blank[beepDuplicate Password
  2578.                !],password)
  2579.       2.   When entering records via procedures.
  2580.       When you use a procedure to enter a new record to a form it is
  2581.       not automatically checked as "Unique".   To ensure that
  2582.       duplicate entries are not entered via procedures you must check
  2583.       that the data entered on the procedures input screen is unique
  2584.       to the form you are about to enter it to before running the
  2585.       procedure.  For example: If you were about to enter a record to
  2586.       the "Manufacturers" form in which the "Name" field was unique
  2587.       then the "Name" field on the input screen would be derived:-
  2588.          if(lookup(manufacturers,name) <> blank,blank[beepDuplicate
  2589.                     Name !cursor name],name)
  2590.                                 - 65 -
  2591. ................................................................................
  2592.       FORM LETTERS                                
  2593. FORM LETTERS
  2594.       To print form letters (circulars) with a different address and
  2595.       salutation for each entry in an address form simply type the
  2596.       entire letter between the .List Items and .End of the output
  2597.       format.
  2598.       .........................procedure code........
  2599.       Declare output fields
  2600.          Addr.name : Addr.street : Addr.town
  2601.          Addr.salutation
  2602.          date
  2603.       end
  2604.       date = datetext(system date)
  2605.       for addr
  2606.          print list items
  2607.          page feed
  2608.       next
  2609.       .........................output format........
  2610.       .List Items
  2611.                                              My street
  2612.                                              My county
  2613.                                              {date field  }
  2614.       {Addr.name field    }
  2615.       {Addr.street field  }
  2616.       {Addr.town field    }
  2617.       Dear {Addr.salutation},
  2618.           You are invited................................
  2619.       ...................................................
  2620.       ...................................................
  2621.       ..........................................
  2622.       Yours faithfully,
  2623.       Fred A Blogs
  2624.       .End
  2625.       Although this is the fastest way to produce a short form
  2626.       letter, the Format Editor is not the nicest place to write
  2627.       text. If you want the benefits of word wrap and spell checking
  2628.       then you can create a form in which to write the letter. Create
  2629.       text block fields to hold a page of text and a name field so
  2630.       that you can store many different letters and print them with
  2631.       the same procedure. If your letters are to be more than one
  2632.       page long then put the same name on each page.
  2633.                                 - 66 -
  2634. ................................................................................
  2635.       FORM LETTERS                                
  2636. FORM LETTERS
  2637.       To print the form letters from the "Letters" form your
  2638.       procedure must now have an input screen which looks up the name
  2639.       of the letter to be printed.
  2640.       '............................CODE.....................
  2641.       declare output fields
  2642.          addr.name : addr.street : addr.town :addr.salutation
  2643.          date :letters.block1 :letters.block2 :letters.block3
  2644.       end
  2645.       declare variables
  2646.          page as number
  2647.       end
  2648.       date = datetext(system date)
  2649.       for addr
  2650.          page = 0
  2651.          for letters with name = input.name
  2652.             page = page + 1
  2653.             if page = 1 then print list items
  2654.             if page > 1 then print extra
  2655.             page feed
  2656.          next
  2657.       next
  2658.       The output format is similar to that shown on the previous page
  2659.       but the text in the .list items section is replaced by the text
  2660.       block fields Letters.block1 ,letters.block2 and letters.block3
  2661.       and an additional section .extra is added which has the same
  2662.       text block fields but no address or salutation.
  2663.                                 - 67 -
  2664. ................................................................................
  2665.       GLOBAL DEFAULTS                             
  2666. GLOBAL DEFAULTS
  2667.       In many instances, an application will use the same default
  2668.       values in many procedures and field derivations. If you
  2669.       "hardwire" these as constants into your procedures and code
  2670.       then they will all have to be changed when the default value
  2671.       changes.
  2672.       Easy Base is supplied with a single global defaults form for
  2673.       VAT rates but you can create your own for any particular
  2674.       application.
  2675.       For instance, should you write a payroll system you would wish
  2676.       to be able to update the tax rates and bands globally
  2677.       throughout your application when they change.
  2678.       To do this, create a form to hold all the global defaults. In
  2679.       addition to the default fields add a single character text
  2680.       field derived "X" and index it. You then enter a single record
  2681.       with all the default values. The "X" field is there to create
  2682.       an artificial relationship between any input screen and the
  2683.       defaults form in order to lookup defaults.
  2684.       Wherever you need one or more global defaults in an input
  2685.       screen you simply add an invisible "x" field and enter a
  2686.       relationship between the procedure and the defaults form
  2687.       linking the "x" fields.
  2688.       The field "Tax" can now be derived:-
  2689.          taxablepay * lookup(defaults,taxrate)
  2690.       Similarly, you can pre load variables in procedure code for the
  2691.       default values:-
  2692.       Declare variables
  2693.         Taxrate1 as number:Taxrate2 as number
  2694.         Taxband1 as number:Taxband2 as number
  2695.       end
  2696.       for defaults
  2697.         Taxrate1 = defaults.taxrate1 :Taxrate2 = defaults.taxrate2
  2698.         Taxband1 = defaults.taxband1 :Taxband2 = defaults.taxband2
  2699.       next
  2700.       When the taxrates change you only have to alter them once in
  2701.       the Defaults form.
  2702.                                 - 68 -
  2703. ................................................................................
  2704.       Input Screen Format                         
  2705. Input Screen Format
  2706.       All form and input screens can be presented either mounted in a
  2707.       window against a mottled background or exactly as drawn in form
  2708.       design. The windowing effect is done automatically if you leave
  2709.       a clear border around all text and fields. If you place fields
  2710.       or text anywhere against the edge of the screen (even invisible
  2711.       fields) then the window effect will not be invoked.
  2712.       If you do not want the window effect but you still wish to
  2713.       leave a clear border then you should place the invisible text
  2714.       character (ASCII 255) in the top left hand corner of the
  2715.       screen to disable it. To produce the invisible character hold
  2716.       down the Alt Key and type 255 on the numeric keypad.
  2717.                                 - 69 -
  2718. ................................................................................
  2719.       Invoicing/Ordering                          
  2720. Invoicing/Ordering
  2721.       To create a simple order processing or invoicing system you
  2722.       need forms for :
  2723.          Stock     (ID#,descrip,price,qtyonhand etc)
  2724.          Customers (ID#,name,address etc)
  2725.          Lineitems (Customer ID,Item ID,Qty,price)
  2726.          Last      (Single record with Last invoice/order number)
  2727.          Current   (Single record for current Cust ID/Invoice No)
  2728.       Both of the forms "Last" and "Current" also have a field called
  2729.       "X" which is a single character indexed text field containing
  2730.       the character "x"
  2731.       You also need three procedures:
  2732.          SelectCustomer
  2733.          EnterItems
  2734.          PrintInvoice
  2735.       The first procedure has an input screen on which you verify the
  2736.       Customers ID# for the invoice. Whether you do this by entering
  2737.       the ID# and looking up the name and address to verify it or by
  2738.       using a primary lookup on the customers name is up to you.
  2739.       The input screen also has an invisible single character text
  2740.       field which is derived "X" and an InvoiceNo field. As well as
  2741.       the relationship to lookup the customers name, the input screen
  2742.       is also related to the Last form linking the "X" fields.
  2743.       The InvoiceNo field is derived Lookup(Last,InvoiceNo) + 1
  2744.       When you have looked up the Customer you run this procedure
  2745.       which has the code:
  2746.       ...................................................
  2747.       For Last
  2748.          Last.Invoiceno = Input.Invoiceno : Update Record
  2749.       Next
  2750.       For Current
  2751.          Current.Invoiceno = Input.Invoiceno
  2752.          Current.CustomerID = Input.CustomerID
  2753.          Update Record
  2754.       Next
  2755.       Run EnterItems
  2756.       ..............................................
  2757.       The second procedure "Enteritems" now takes over and it has an
  2758.       input screen where you lookup items from your stock form
  2759.       together with their price, and enter the quantity. This
  2760.       procedure has a repeating input screen. It is used to enter one
  2761.       line at a time into the LineItems form. You must also nominate
  2762.       a function key which will be used to run the PrintInvoice
  2763.       procedure when all invoice items have been entered. A suitable
  2764.       default help line might be:-
  2765.                                 - 70 -
  2766. ................................................................................
  2767.       Invoicing/Ordering                          
  2768. Invoicing/Ordering
  2769.       "F2=Enter Invoice Item   F4=Print Invoice  F10=Cancel"
  2770.       It is important that the user should not terminate this
  2771.       procedure with the escape key so you should disable it and the
  2772.       other function keys in one of your field derivations:
  2773.       Disable "Esc5789"
  2774.       Like the SelectCustomer procedure this screen also has an
  2775.       invisible "x" field - no entry and derived "X". This time it is
  2776.       related to the X field in the Current form. There are fields
  2777.       for InvoiceNo and CustomerID. Both are no entry and are
  2778.       derived: Lookup(Current,InvoiceNo)  Lookup(Current,CustomerID)
  2779.       The main relationship of course is to the Stock form to lookup
  2780.       the stock item and price. Again, like the first procedure, it
  2781.       is up to you whether you enter stock ID#s and lookup the
  2782.       description and price or do a primary lookup on the Stock
  2783.       Descrip field. This procedure writes a new record to the
  2784.       LineItems form if F2 is pressed, runs Printinvoice if F4 is
  2785.       pressed and "Tidies Up" if F10 is pressed.
  2786.       ................................................
  2787.       If Fun_Key = 4 then run Printinvoice
  2788.       If Fun_Key = 10 then
  2789.          for LineItems with InvoiceNo = Input.InvoiceNo
  2790.             Delete Record
  2791.          Next
  2792.          For Last
  2793.             Last.Invoiceno = Last.Invoiceno - 1 : Update record
  2794.          Next
  2795.          Run SelectCustomer
  2796.       End if
  2797.       For LineItems new record
  2798.          Copy all from Input
  2799.       Next
  2800.       ..............................................
  2801.       The third procedure "PrintInvoice" is run when the user presses
  2802.       F4 and has the Following code.
  2803.       Declare output fields
  2804.          Customers.Name : Customers.Address
  2805.          LineItems.StockID : LineItems.Descrip : LineItems.Qty
  2806.          LineItems.Price
  2807.          LineTotal : SubTotal : Tax : GrandTotal
  2808.          InvoiceNo : CustomerID
  2809.       End
  2810.       '............Get Nos from Current
  2811.       For Current
  2812.          InvoiceNo = Current.Invoiceno
  2813.          CustomerID = Current.CustomerID
  2814.       Next
  2815.                                 - 71 -
  2816. ................................................................................
  2817.       Invoicing/Ordering                          
  2818. Invoicing/Ordering
  2819.       '.......Print Customer details to invoice header
  2820.       For Customers with ID = CustomerID
  2821.          Print Report Header
  2822.       Next
  2823.       '.................Print Invoice Lines...
  2824.       For LineItems with InvoiceNo = InvoiceNo
  2825.          LineTotal = LineItems.Price * LineItems.Qty
  2826.          SubTotal = Subtotal + LineTotal
  2827.          Print List Items
  2828.          '........Update Stock on hand
  2829.          For stock with ID = LineItemsID
  2830.             Stock.Qtyonhand = Stock.Qtyonhand - LineItems.Qty
  2831.             Update Record
  2832.          Next
  2833.       Next
  2834.       ,..................Report Footer
  2835.       Tax = VATon(SubTotal)
  2836.       GrandTotal = Subtotal + Tax
  2837.       Print Report Footer
  2838.       Page Feed
  2839.       Notice that the Quantity on hand field in the stock form is not
  2840.       updated until you actually print the invoice. You could have
  2841.       done it while you were entering the Line Items but it would
  2842.       make the tidying process more complicated if the invoice were
  2843.       cancelled with F10 after items had been written.
  2844.                                 - 72 -
  2845. ................................................................................
  2846.       Keyword/Text Search                         
  2847. Keyword/Text Search
  2848.       If you have a database with a large number of items where the
  2849.       user would be unlikely to know exactly what he is looking for
  2850.       you will need to provide a search facility based on text
  2851.       supplied by the user. There are two main ways to do this and
  2852.       both have advantages in different situations.
  2853.       Suppose you have a form for technical publications. There are
  2854.       fields for Name, Publisher, Price, Short Description Etc. A
  2855.       user wishing to search this form will not know the contents of
  2856.       any of the fields - he will only know the topic or subject
  2857.       which he wants to look up.
  2858.       You need to get some search text from the user, find the names
  2859.       of any publications which may cover the subject then make a
  2860.       short list of them in the PickList form.
  2861.       The simplest way is to have an input screen field where the
  2862.       user can enter search text, then search the "ShortDescrip"
  2863.       field for the occurrence of the text he has entered. Wherever
  2864.       his text is found you add a new record to the PickList form.
  2865.       The user can then mark the titles which interest him and you
  2866.       can print out the short descriptions of the publications he has
  2867.       chosen.
  2868.       Clear records from PickList
  2869.       for Publications
  2870.          If intext(shortdescrip,input.searchtext) > 0 then
  2871.             for PickList new record
  2872.                PickList.Item = Publications.Name
  2873.             next
  2874.          end if
  2875.       next
  2876.       Show Picklist
  2877.       For PickList with Mark = Chr$(251)
  2878.          For Publications with Name = Picklist.Item
  2879.             Print List Items
  2880.          next
  2881.       next
  2882.       The advantage of this method is that the user is free to enter
  2883.       any text and will get a "Hit" if it exists anywhere in the
  2884.       description. The disadvantage is that every record in the
  2885.       publications form has to be searched. This form of searching
  2886.       becomes too time consuming if there are many thousands of
  2887.       records. You can overcome the time problem in a large database
  2888.       by adding a KeyWord form.
  2889.       A KeyWord form has two fields, one for the publication name and
  2890.       one for a key word. Each publication can have several entries
  2891.       in this form with different key words. The Keyword field is
  2892.       indexed so if you now search this form for the entered text you
  2893.       will get a list of publications with the entered keyword very
  2894.                                 - 73 -
  2895. ................................................................................
  2896.       Keyword/Text Search                         
  2897. Keyword/Text Search
  2898.       quickly. The disadvantage of this method is that the user will
  2899.       only get a "Hit" if he enters a word that you have chosen as a
  2900.       KeyWord.
  2901.       You can optimize this method by choosing Keywords that might
  2902.       contain text the user might enter within them. Eg use the
  2903.       keyword "Installation" rather than "Install" and make your
  2904.       routine select with >= rather than =
  2905.       Declare variables
  2906.         Len as number
  2907.       end
  2908.       Len = lengthtext(input.searchtext)
  2909.       For Keywords with Key >= input.searchtext
  2910.          if lefttext(keywords.Key,Len) <> input.searchtext then
  2911.             exit for
  2912.          end if
  2913.          for PickList new Record
  2914.             Picklist.Item = Keywords.Publication
  2915.          next
  2916.       Next
  2917.       Show Picklist
  2918.       For PickList with Mark = Chr$(251)
  2919.          For Publications with Name = PickList.Item
  2920.             Print List Items
  2921.          Next
  2922.       Next
  2923.       Entering Keyword records can be incorporated into the procedure
  2924.       which writes the Publications record to save time when entering
  2925.       data.
  2926.       For Publications new record
  2927.          Copy all from input
  2928.       Next
  2929.       for Keywords new record
  2930.          Keywords.Publication = Input.Name
  2931.          Keywords.Key = Input.Keyword1
  2932.       next
  2933.       If Input.Keyword2 <> blank then
  2934.          For Keywords new record
  2935.             Keywords.Publication = Input.Name
  2936.             Keywords.Key = Input.Keyword2
  2937.          Next
  2938.       End if
  2939.       Repeat last section for the number of keywords on the input
  2940.       screen.
  2941.                                 - 74 -
  2942. ................................................................................
  2943.       LINKING APPLICATIONS                        LINKING APPLICATIONS
  2944.       Procedures in one directory can access forms in another
  2945.       directory or disk by placing the external forms path in
  2946.       brackets immediately after the form name at the start of a For
  2947.       Loop.
  2948.       Ex.
  2949.       For payroll (c:\pay) with posted = "No"
  2950.          for purchaseledger new record
  2951.             copy all from payroll
  2952.          next
  2953.          payroll.posted = "Yes"
  2954.          update record
  2955.       next
  2956.       The above procedure, in an accounts application, imports data
  2957.       from a payroll application in C:\PAY and updates the "Posted"
  2958.       field in the payroll application.
  2959.       Ex.
  2960.       for sales (A:\) alias import
  2961.          for sales new record
  2962.            copy all from import
  2963.          next
  2964.       next
  2965.       The above procedure is used to import data transferred from one
  2966.       machine to another on floppy disk.
  2967.       Note:-
  2968.       1.   If transferring data on floppy disk the floppy must hold
  2969.       the forms .DAT and .DEF files together with the BASE.DIR from
  2970.       the source application. If you need to move large amounts of
  2971.       data on floppy it is much quicker to simply overwrite an import
  2972.       forms .DAT file and then pack it to rewrite the indices.
  2973.                                 - 75 -
  2974. ................................................................................
  2975.       MAXIMIZING SPEED                            
  2976. MAXIMIZING SPEED
  2977.       Because the procedures you create in Easy Base have to be
  2978.       interpreted each time they are run they will tend to be slower
  2979.       than similar routines created in a compiled system. This is the
  2980.       unavoidable cost of ease of use. You can increase speed vastly
  2981.       by having the best DOS environment and by the way in which you
  2982.       write procedure code.
  2983.       DOS Environment.
  2984.       1.   Do not use a disk compression system.
  2985.       2.   Always load "Fastopen"  - The default settings are fine -
  2986.            just add the line "fastopen C:" to your AUTOEXEC.BAT file.
  2987.       3.   Use a Disk Cacheing system - The more memory you can
  2988.            allocate to it the better. Easy Software recommends
  2989.            PC-Cache from Centre Point with 2 Megabytes of expanded
  2990.            memory allocated. Smartdrive (Version supplied with
  2991.            Windows 3.1) was slightly faster but caused widespread
  2992.            disk corruptions during test "Power Failures".
  2993.       4.   Do not run any TSR programs (Especially Virus Checkers).
  2994.       Procedure Code.
  2995.       Avoid making calculations and derivations within "For" loops in
  2996.       procedures.
  2997.       If, for example, you had a form in which was recorded the
  2998.       length, breadth and depth of various blocks and you knew that
  2999.       at some point you would write a procedure which listed their
  3000.       volume. Add a field for volume to the form and derive it from
  3001.       the other fields. When you write the procedure you will simply
  3002.       list this field. If the field had not been added to the form
  3003.       then you would have to calculate its value on each iteration of
  3004.       the "For" loop.
  3005.       The time taken to derive each individual "Volume" field during
  3006.       record entry will not be noticeable but the time taken to
  3007.       derive the volume for every record during the procedure will.
  3008.       Keep "Running statistics".  If your program requires statistics
  3009.       derived from many hundreds or even thousands of records then
  3010.       having to wait for a procedure which calculates them each time
  3011.       you want up to date figures is a real pain.
  3012.       To keep "running statistics" create a form with a field for
  3013.       each statistic you require and enter a single record with zero
  3014.       values in each field. Make all entries, modifications and
  3015.       deletions to your data via procedures and you can update your
  3016.       statistics each time a record is added, modified or deleted.
  3017.       Example on next page.
  3018.                                 - 76 -
  3019. ................................................................................
  3020.       MAXIMIZING SPEED                            
  3021. MAXIMIZING SPEED
  3022.       The following procedure code enters a record (collected via the
  3023.       input screen) to a purchases ledger and updates statistics used
  3024.       in the profit and loss account. It also updates the balance for
  3025.       the suppliers account.
  3026.       pause off : Escape off
  3027.       for purchases new record
  3028.          copy all from input
  3029.       next
  3030.       for stats
  3031.          if input.type = "Invoice" then
  3032.             stats.creditors = stats.creditors + input.amount
  3033.          end if
  3034.          if input.type = "CreditNote" then
  3035.             stats.creditors = stats.creditors - input.amount
  3036.          end if
  3037.          if input.type = "Payment" then
  3038.             stats.creditors = stats.creditors - input.amount
  3039.             if input.paidby = "cash" then
  3040.                stats.cashbalance = stats.cashbalance - input.amount
  3041.             else
  3042.                stats.bankbalance = stats.bankbalance - input.amount
  3043.             end if
  3044.          end if
  3045.       next
  3046.       for ACbalances with supplier = input supplier
  3047.          if input.type = "Invoice" then
  3048.             ACbalances.balance = ACbalances.balance + input.amount
  3049.          else
  3050.             ACbalances.balance = ACbalances.balance - input.amount
  3051.          end if
  3052.       next
  3053.       Whenever you need to know statistics for "Debtors", "Cash
  3054.       Balance" etc you can produce them instantly with a procedure
  3055.       which simply lists data from the statistics forms.
  3056.       Whenever you use running statistics in this way you should also
  3057.       create a procedure which does calculate them from the raw data.
  3058.       If you ever, for one reason or another, have to edit data
  3059.       directly in "Data entry" then your "running statistics" will no
  3060.       longer be accurate. You can run this procedure to correct them.
  3061.                                 - 77 -
  3062. ................................................................................
  3063.       MULTIPLE COLUMNS                            
  3064. MULTIPLE COLUMNS
  3065.       You may occasionally need to list data in order but in more
  3066.       than one column. Indexes for technical manuals are a common
  3067.       example. It would be nice if you could send the printer head
  3068.       back to the top of the page for each column but you can't. You
  3069.       must therefore get all the data for each horizontal line into
  3070.       memory at the same time and then print it.
  3071.       The following example prints the "Title" field from a "Films"
  3072.       form in alphabetic order in two columns with fifty lines on
  3073.       each page. To do this a field "No" is added to the form. This
  3074.       is an integer field and it is indexed.
  3075.       declare output fields
  3076.          films.title : righttitle
  3077.       end
  3078.       declare variables
  3079.          x as number  : y as number : lasttitle as text
  3080.       end
  3081.       '................UPDATE THE No FIELD......
  3082.       for films with title in order
  3083.          y = total records
  3084.          x = x + 1
  3085.          display status "Updating No field record" + x + "of" + y
  3086.          films.No = x
  3087.          update record
  3088.       next
  3089.       '.................PRINT IN TWO COLUMNS.................
  3090.       x = 0                        'reuse x as counter
  3091.       do
  3092.          for films with title > lasttitle
  3093.             x = x + 1
  3094.             for films alias col2 with No = films.No + 50
  3095.               righttitle = col2.title
  3096.             next
  3097.             print list items
  3098.             lasttitle = righttitle : righttitle = blank
  3099.             if mod(x,50) = 0 then
  3100.                page feed : Exit for
  3101.             end if
  3102.          next
  3103.          if lasttitle = blank then exit do
  3104.       loop
  3105.       ........................Format..................
  3106.       .list items
  3107.             { Films.title field  }      {  Righttitle Field  }
  3108.       .end
  3109.                                 - 78 -
  3110. ................................................................................
  3111.       Printing System Val.                        Printing System Val.
  3112.       In Easy Base procedures most system values are supplied as
  3113.       fields and can be declared as output fields. Others are
  3114.       internal values and cannot.
  3115.       The internal values are:-
  3116.       System Date
  3117.       System Time
  3118.       Pi
  3119.       Terminal Number
  3120.       To print an internal value you must declare an ad hoc field and
  3121.       transfer the system value to it.
  3122.       Declare output fields
  3123.          date
  3124.       end
  3125.       date = system date
  3126.                                 - 79 -
  3127. ................................................................................
  3128.       Q AND A INPUT SCREEN                        Q AND A INPUT SCREEN
  3129.       If, for a procedure you have to collect many items of data via
  3130.       an input screen, then presenting all the fields and their
  3131.       labels at once can be confusing to an operator.  You can start
  3132.       with an empty screen other than the first field and its prompt
  3133.       then have each subsequent prompt "Pop up" when the previous
  3134.       field has been filled.
  3135.       To do this you make all your input fields without a background
  3136.       (Text, Alt1 or Alt2) and you create fields for the prompts
  3137.       which have no user entry and also show no background.
  3138.       Ex.
  3139.       To collect data for paymethod, customer, and amount lay out the
  3140.       following fields:-
  3141.               Enter Method of payment....     { Paymethod Field }
  3142.               { Pop1 Field               }    { Customer Field  }
  3143.               { Pop2 Field               }    { Amount Field   }
  3144.       The "Pop1" field is derived:-
  3145.          If(Pop1 = blank and paymethod = blank,blank,"Enter Customers
  3146.                  name.........")
  3147.       and the "Pop2" field is derived:-
  3148.          If(Pop2 = blank and customer = blank,blank,"Enter Amount...
  3149.                 ...............")
  3150.                                 - 80 -
  3151. ................................................................................
  3152.       RUNTIME AUTO START                          
  3153. RUNTIME AUTO START
  3154.       If you intend to distribute an application using the Easy Base
  3155.       Runtime Module, you can have the module start automatically on
  3156.       a particular user menu by giving that menu the sign on password
  3157.       "Autostart".
  3158.       Each time the runtime module starts it searches for a menu with
  3159.       this password. If it finds one, it skips the sign on screen and
  3160.       starts automatically on this menu.
  3161.       The "Autostart" password has no significance while developing
  3162.       in Easy Base. It is treated as any other sign on password.
  3163.                                 - 81 -
  3164. ................................................................................
  3165.       SET SYSTEM VALUES                           
  3166. SET SYSTEM VALUES
  3167.       The System values System date, System Time and Output can be
  3168.       set within procedure code.
  3169.       Ex.
  3170.          System Date = input.date
  3171.       Ex.
  3172.          If input.print = "Yes" then Output = "Printer"
  3173.       Setting the output from an input screen field means that the
  3174.       user can change the output destination without having to exit
  3175.       back to the menu in procedures which have repeating input
  3176.       screens.
  3177.       If you have several procedures which are individually run to
  3178.       the screen but you also wish to batch execute them to the
  3179.       printer, you can achieve this by including the line:-
  3180.          If Global number = 2 then output = "Printer"
  3181.       then placing the procedures on a batch execute menu which
  3182.       begins with a procedure setting Global Number to 2. and ends
  3183.       with one re setting it to zero.
  3184.                                 - 82 -
  3185. ................................................................................
  3186.       TABULATION                                  
  3187. TABULATION
  3188.       To create a printout in which fields are enclosed within a
  3189.       lined table use the linedrawing facility in the format editor
  3190.       to create a page header and page footer containing the top and
  3191.       bottom of the table and insert only the vertical lines between
  3192.       the fields in the list items section.
  3193.       Ex.
  3194.       Declare output fields
  3195.          stock.name : stock.price
  3196.       end
  3197.       print page header
  3198.       for stock with name in order
  3199.          if bottom margin < 0.7 then
  3200.             print page footer
  3201.             page feed
  3202.             print page header
  3203.          end if
  3204.          print list items
  3205.       next
  3206.       print page footer
  3207.       Page feed
  3208.       ........................format.........................
  3209.       .page header
  3210.             
  3211.             
  3212.  Name               
  3213.   Price        
  3214.             
  3215.       .list items
  3216.             
  3217.  {Name Field     }  
  3218.  {Price Fld. } 
  3219.       .page footer
  3220.             
  3221.       .end
  3222.                                 - 83 -
  3223. ................................................................................
  3224.       TOTALS & SUB TOTALS                         
  3225. TOTALS & SUB TOTALS
  3226.       To produce totals and sub totals in printouts use ad hoc fields
  3227.       to hold the values and increment them during each iteration of
  3228.       the output loops. The following code lists all entries in a
  3229.       clients time sheet form with the cost of work in hand totalled
  3230.       and sub totalled for each client.
  3231.       Declare output fields
  3232.         Clients.Name:Timesheet.Hrs:Timesheet.Mins:Timesheet.Amount
  3233.         Timesheet.date : Subtotal : Grandtotal
  3234.       end
  3235.       Print Report Header
  3236.       for Clients with name in order
  3237.          Print Group Header
  3238.          Subtotal = 0
  3239.          For Timesheet with Acno = Clients.Acno
  3240.             Subtotal = Subtotal + timesheet.amount
  3241.             Grandtotal = Grandtotal + Timesheet.amount
  3242.             Print List Items
  3243.          next
  3244.          Print Group Footer
  3245.       next
  3246.       Print report footer
  3247.       .......................Output Format.........................
  3248.       .Report Header
  3249.          
  3250.                    Work in Hand Totalled by Client
  3251.          
  3252.       .Group Header
  3253.          
  3254.       .List Items
  3255.             
  3256.       
  3257. Mins                     
  3258.       .Group Footer
  3259.                                                        
  3260.           Total for 
  3261.                  
  3262.                                                        
  3263.       .Report Footer
  3264.          
  3265.          Total Work In Hand                            
  3266.          
  3267.       .end
  3268.       The field in the Group Header is Clients.name
  3269.       The fields in List Items are Timesheet.date, Timesheet.Hrs,
  3270.       Timesheet.Mins and Timesheet.amount.
  3271.       The fields in Group Footer are Clients.name and Subtotal.
  3272.       The field in Report Footer is Grandtotal.
  3273.                                 - 84 -
  3274. ................................................................................
  3275.